diff options
| author | Ady Abraham <adyabr@google.com> | 2020-10-05 17:59:09 -0700 |
|---|---|---|
| committer | Ady Abraham <adyabr@google.com> | 2020-10-09 11:17:32 -0700 |
| commit | dfb13985aff33cda393ffefc0db3103443f3be49 (patch) | |
| tree | 25f497b88843c109e7ba08aa8a442d0a23336bc9 /core/java/android/view/DisplayEventReceiver.java | |
| parent | 6057df4f9e36765965fa787c0670ed6ac964138e (diff) | |
pass frame deadline to Choreographer
Pass the frame deadline calculated by SF to Choreographer so
hwui would be able to improve its stats by knowing if a frame is
likely to be late.
Bug: 169858174
Test: manual
Change-Id: Ib9fd93638b54f08d8dc72fa6b023e2dd7c276dc7
Diffstat (limited to 'core/java/android/view/DisplayEventReceiver.java')
| -rw-r--r-- | core/java/android/view/DisplayEventReceiver.java | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/core/java/android/view/DisplayEventReceiver.java b/core/java/android/view/DisplayEventReceiver.java index 51474d3c39c8..467d93ef3aaf 100644 --- a/core/java/android/view/DisplayEventReceiver.java +++ b/core/java/android/view/DisplayEventReceiver.java @@ -17,6 +17,7 @@ package android.view; import android.compat.annotation.UnsupportedAppUsage; +import android.graphics.FrameInfo; import android.os.Looper; import android.os.MessageQueue; import android.util.Log; @@ -145,6 +146,26 @@ public abstract class DisplayEventReceiver { mMessageQueue = null; } + static final class VsyncEventData { + // The frame timeline vsync id, used to correlate a frame + // produced by HWUI with the timeline data stored in Surface Flinger. + public final long id; + + // The frame deadline timestamp in {@link System#nanoTime()} timebase that it is + // allotted for the frame to be completed. + public final long frameDeadline; + + VsyncEventData(long id, long frameDeadline) { + this.id = id; + this.frameDeadline = frameDeadline; + } + + VsyncEventData() { + this.id = FrameInfo.INVALID_VSYNC_ID; + this.frameDeadline = Long.MAX_VALUE; + } + } + /** * Called when a vertical sync pulse is received. * The recipient should render a frame and then call {@link #scheduleVsync} @@ -154,11 +175,10 @@ public abstract class DisplayEventReceiver { * timebase. * @param physicalDisplayId Stable display ID that uniquely describes a (display, port) pair. * @param frame The frame number. Increases by one for each vertical sync interval. - * @param frameTimelineVsyncId The frame timeline vsync id, used to correlate a frame - * produced by HWUI with the timeline data stored in Surface Flinger. + * @param vsyncEventData The vsync event data. */ public void onVsync(long timestampNanos, long physicalDisplayId, int frame, - long frameTimelineVsyncId) { + VsyncEventData vsyncEventData) { } /** @@ -201,8 +221,9 @@ public abstract class DisplayEventReceiver { // Called from native code. @SuppressWarnings("unused") private void dispatchVsync(long timestampNanos, long physicalDisplayId, int frame, - long frameTimelineVsyncId) { - onVsync(timestampNanos, physicalDisplayId, frame, frameTimelineVsyncId); + long frameTimelineVsyncId, long frameDeadline) { + onVsync(timestampNanos, physicalDisplayId, frame, + new VsyncEventData(frameTimelineVsyncId, frameDeadline)); } // Called from native code. |
