Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9781fe9e authored by Rachel Lee's avatar Rachel Lee Committed by Cherrypicker Worker
Browse files

Set default frameTimelinesLength to 1

The default FrameTimeline has some default values.
This is to account for Choreographer MSG_DO_FRAME case, which creates
a default VsyncEventData since it only uses frame time.

Bug: 285093700
Bug: 286928743
Test: Set USE_VSYNC to false
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:88691bea18b94b42052e993f69714ff327647c7e)
Merged-In: I3b3274470101ed77e6718c5882ac9c59125a50b8
Change-Id: I3b3274470101ed77e6718c5882ac9c59125a50b8
parent e712c2a8
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -158,7 +158,11 @@ public abstract class DisplayEventReceiver {
        static final int FRAME_TIMELINES_CAPACITY = 7;

        public static class FrameTimeline {
            FrameTimeline() {}
            FrameTimeline() {
                // Some reasonable values (+10 ms) for default timestamps.
                deadline = System.nanoTime() + 10_000_000;
                expectedPresentationTime = deadline + 10_000_000;
            }

            // Called from native code.
            @SuppressWarnings("unused")
@@ -179,11 +183,11 @@ public abstract class DisplayEventReceiver {
            public long vsyncId = FrameInfo.INVALID_VSYNC_ID;

            // The frame timestamp for when the frame is expected to be presented.
            public long expectedPresentationTime = Long.MAX_VALUE;
            public long expectedPresentationTime;

            // The frame deadline timestamp in {@link System#nanoTime()} timebase that it is
            // allotted for the frame to be completed.
            public long deadline = Long.MAX_VALUE;
            public long deadline;
        }

        /**
@@ -197,7 +201,9 @@ public abstract class DisplayEventReceiver {

        public int preferredFrameTimelineIndex = 0;

        public int frameTimelinesLength = 0;
        // The default FrameTimeline is a placeholder populated with invalid vsync ID and some
        // reasonable timestamps.
        public int frameTimelinesLength = 1;

        VsyncEventData() {
            frameTimelines = new FrameTimeline[FRAME_TIMELINES_CAPACITY];