From e4a9000b031ba2d613e015db990fe7890391db1f Mon Sep 17 00:00:00 2001 From: Ady Abraham Date: Tue, 15 Feb 2022 15:06:16 -0800 Subject: [PATCH] Correct JankData.PREDICTION_ERROR meaning JankData.PREDICTION_ERROR is asserted when SF vsync calculation is incorrect and should be attributed to SF missed frames. Bug: 211763914 Test: SF unit tests Change-Id: I332480ad1017c220501ed938319f8b2fbfe22826 --- core/java/android/view/SurfaceControl.java | 4 +--- core/java/com/android/internal/jank/FrameTracker.java | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index ce54968658858..85a980ef5a0e5 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -386,9 +386,7 @@ public final class SurfaceControl implements Parcelable { public static final int JANK_SURFACEFLINGER_GPU_DEADLINE_MISSED = 0x4; // Either App or GPU took too long on the frame public static final int JANK_APP_DEADLINE_MISSED = 0x8; - // Predictions live for 120ms, if prediction is expired for a frame, there is definitely a - // jank - // associated with the App if this is for a SurfaceFrame, and SF for a DisplayFrame. + // Vsync predictions have drifted beyond the threshold from the actual HWVsync public static final int PREDICTION_ERROR = 0x10; // Latching a buffer early might cause an early present of the frame public static final int SURFACE_FLINGER_SCHEDULING = 0x20; diff --git a/core/java/com/android/internal/jank/FrameTracker.java b/core/java/com/android/internal/jank/FrameTracker.java index e1a67d861bcb9..9eea8a5d06e4c 100644 --- a/core/java/com/android/internal/jank/FrameTracker.java +++ b/core/java/com/android/internal/jank/FrameTracker.java @@ -464,8 +464,7 @@ public class FrameTracker extends SurfaceControl.OnJankDataListener if (info.surfaceControlCallbackFired) { totalFramesCount++; boolean missedFrame = false; - if ((info.jankType & PREDICTION_ERROR) != 0 - || ((info.jankType & JANK_APP_DEADLINE_MISSED) != 0)) { + if ((info.jankType & JANK_APP_DEADLINE_MISSED) != 0) { Log.w(TAG, "Missed App frame:" + info.jankType); missedAppFramesCount++; missedFrame = true; @@ -473,7 +472,8 @@ public class FrameTracker extends SurfaceControl.OnJankDataListener if ((info.jankType & DISPLAY_HAL) != 0 || (info.jankType & JANK_SURFACEFLINGER_DEADLINE_MISSED) != 0 || (info.jankType & JANK_SURFACEFLINGER_GPU_DEADLINE_MISSED) != 0 - || (info.jankType & SURFACE_FLINGER_SCHEDULING) != 0) { + || (info.jankType & SURFACE_FLINGER_SCHEDULING) != 0 + || (info.jankType & PREDICTION_ERROR) != 0) { Log.w(TAG, "Missed SF frame:" + info.jankType); missedSfFramesCount++; missedFrame = true;