summaryrefslogtreecommitdiff
path: root/core/java/android/view/DisplayEventReceiver.java
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2021-01-19 00:08:02 +0100
committerJorim Jaggi <jjaggi@google.com>2021-04-13 15:18:27 +0000
commit10f328c580fe1e897b51a7e4b38ee4c341d970f1 (patch)
treeb5719df2aa8460ef2925440e72ecec07020557b1 /core/java/android/view/DisplayEventReceiver.java
parenta373e1ed5a59997b2cc8ac86615963d8597e4a2b (diff)
Change hwui jank detection to use deadline & gpu completion (1/2)
- Use GPU finish time as well as actual deadline to determine jank rate. - Use dynamic interval to adjust for 60/90hz switching - Move frame metrics reporting into JankTracker to adjust the deadline communicated to the app when in stuffing scenario. - Adjust double-stuffing detection to be a bit more readable. Test: GraphicsStatsValidationTest.java Test: adb shell dumpsys gfxinfo Test: FrameMetricsListenerTest Test: Log output of FrameMetricsObserver Bug: 169858044 Change-Id: I3a6b8ed163e2cf9cf2b67667110340ebe35f98a1
Diffstat (limited to 'core/java/android/view/DisplayEventReceiver.java')
-rw-r--r--core/java/android/view/DisplayEventReceiver.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/view/DisplayEventReceiver.java b/core/java/android/view/DisplayEventReceiver.java
index e6cd25275ca2..e3f430bf3fe0 100644
--- a/core/java/android/view/DisplayEventReceiver.java
+++ b/core/java/android/view/DisplayEventReceiver.java
@@ -158,14 +158,23 @@ public abstract class DisplayEventReceiver {
// allotted for the frame to be completed.
public final long frameDeadline;
- VsyncEventData(long id, long frameDeadline) {
+ /**
+ * The current interval between frames in ns. This will be used to align
+ * {@link FrameInfo#VSYNC} to the current vsync in case Choreographer callback was heavily
+ * delayed by the app.
+ */
+ public final long frameInterval;
+
+ VsyncEventData(long id, long frameDeadline, long frameInterval) {
this.id = id;
this.frameDeadline = frameDeadline;
+ this.frameInterval = frameInterval;
}
VsyncEventData() {
this.id = FrameInfo.INVALID_VSYNC_ID;
this.frameDeadline = Long.MAX_VALUE;
+ this.frameInterval = -1;
}
}
@@ -259,9 +268,9 @@ public abstract class DisplayEventReceiver {
// Called from native code.
@SuppressWarnings("unused")
private void dispatchVsync(long timestampNanos, long physicalDisplayId, int frame,
- long frameTimelineVsyncId, long frameDeadline) {
+ long frameTimelineVsyncId, long frameDeadline, long frameInterval) {
onVsync(timestampNanos, physicalDisplayId, frame,
- new VsyncEventData(frameTimelineVsyncId, frameDeadline));
+ new VsyncEventData(frameTimelineVsyncId, frameDeadline, frameInterval));
}
// Called from native code.