mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 814437 - Record checkerboarding over time instead of per frame. r=kats
Frame-rate has an unpredictable effect on the results of robocop checkerboarding tests. Instead of recording checkerboarding per frame, record it over time.
This commit is contained in:
parent
8df438c5af
commit
f934392869
@ -602,6 +602,9 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
||||
float checkerboard = 1.0f - GeckoAppShell.computeRenderIntegrity();
|
||||
|
||||
PanningPerfAPI.recordCheckerboard(checkerboard);
|
||||
if (checkerboard < 0.0f || checkerboard > 1.0f) {
|
||||
Log.e(LOGTAG, "Checkerboard value out of bounds: " + checkerboard);
|
||||
}
|
||||
|
||||
mCompleteFramesRendered += 1.0f - checkerboard;
|
||||
mFramesRendered ++;
|
||||
|
@ -27,17 +27,26 @@ public class PanningPerfAPI {
|
||||
private static List<Float> mCheckerboardAmounts;
|
||||
private static long mCheckerboardStartTime;
|
||||
|
||||
public static void startFrameTimeRecording() {
|
||||
if (mRecordingFrames) {
|
||||
Log.e(LOGTAG, "Error: startFrameTimeRecording() called while already recording!");
|
||||
return;
|
||||
}
|
||||
mRecordingFrames = true;
|
||||
private static void initialiseRecordingArrays() {
|
||||
if (mFrameTimes == null) {
|
||||
mFrameTimes = new ArrayList<Long>(EXPECTED_FRAME_COUNT);
|
||||
} else {
|
||||
mFrameTimes.clear();
|
||||
}
|
||||
if (mCheckerboardAmounts == null) {
|
||||
mCheckerboardAmounts = new ArrayList<Float>(EXPECTED_FRAME_COUNT);
|
||||
} else {
|
||||
mCheckerboardAmounts.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static void startFrameTimeRecording() {
|
||||
if (mRecordingFrames || mRecordingCheckerboard) {
|
||||
Log.e(LOGTAG, "Error: startFrameTimeRecording() called while already recording!");
|
||||
return;
|
||||
}
|
||||
mRecordingFrames = true;
|
||||
initialiseRecordingArrays();
|
||||
mFrameStartTime = SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
@ -62,16 +71,12 @@ public class PanningPerfAPI {
|
||||
}
|
||||
|
||||
public static void startCheckerboardRecording() {
|
||||
if (mRecordingCheckerboard) {
|
||||
if (mRecordingCheckerboard || mRecordingFrames) {
|
||||
Log.e(LOGTAG, "Error: startCheckerboardRecording() called while already recording!");
|
||||
return;
|
||||
}
|
||||
mRecordingCheckerboard = true;
|
||||
if (mCheckerboardAmounts == null) {
|
||||
mCheckerboardAmounts = new ArrayList<Float>(EXPECTED_FRAME_COUNT);
|
||||
} else {
|
||||
mCheckerboardAmounts.clear();
|
||||
}
|
||||
initialiseRecordingArrays();
|
||||
mCheckerboardStartTime = SystemClock.uptimeMillis();
|
||||
}
|
||||
|
||||
@ -80,13 +85,30 @@ public class PanningPerfAPI {
|
||||
Log.e(LOGTAG, "Error: stopCheckerboardRecording() called when not recording!");
|
||||
return null;
|
||||
}
|
||||
if (mCheckerboardAmounts.size() != mFrameTimes.size()) {
|
||||
Log.e(LOGTAG, "Error: Inconsistent number of checkerboard and frame time recordings!");
|
||||
return null;
|
||||
}
|
||||
mRecordingCheckerboard = false;
|
||||
|
||||
// The score will be the sum of all the values in mCheckerboardAmounts,
|
||||
// so weight the checkerboard values by time so that frame-rate and
|
||||
// run-length don't affect score.
|
||||
long lastTime = 0;
|
||||
float totalTime = mFrameTimes.get(mFrameTimes.size() - 1);
|
||||
for (int i = 0; i < mCheckerboardAmounts.size(); i++) {
|
||||
long elapsedTime = mFrameTimes.get(i) - lastTime;
|
||||
mCheckerboardAmounts.set(i, mCheckerboardAmounts.get(i) * elapsedTime / totalTime);
|
||||
lastTime = mFrameTimes.get(i);
|
||||
}
|
||||
|
||||
return mCheckerboardAmounts;
|
||||
}
|
||||
|
||||
public static void recordCheckerboard(float amount) {
|
||||
// this will be called often, so try to make it as quick as possible
|
||||
if (mRecordingCheckerboard) {
|
||||
mFrameTimes.add(SystemClock.uptimeMillis() - mCheckerboardStartTime);
|
||||
mCheckerboardAmounts.add(amount);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user