Update FrameInterval using next vsync generated
use the expectedPresentTime + threshold to get
the next frames interval.
Test: atrace and atest libsurfaceflinger_unittest --test-filter="SchedulerTest*"
BUG: 296636176
Change-Id: I9eb0d2784a81491028ec13d579356da2f34b85df
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 6e6229a..f219942 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2619,10 +2619,6 @@
refreshArgs.outputs.push_back(display->getCompositionDisplay());
}
}
- if (display->getId() == pacesetterId) {
- // TODO(b/255601557) Update frameInterval per display
- refreshArgs.frameInterval = display->refreshRateSelector().getActiveMode().fps;
- }
}
mPowerAdvisor->setDisplays(displayIds);
@@ -2687,8 +2683,11 @@
pacesetterTarget.previousFrameVsyncTime(minFramePeriod) - hwcMinWorkDuration;
}
+ const TimePoint expectedPresentTime = pacesetterTarget.expectedPresentTime();
+ // TODO(b/255601557) Update frameInterval per display
+ refreshArgs.frameInterval = mScheduler->getNextFrameInterval(pacesetterId, expectedPresentTime);
refreshArgs.scheduledFrameTime = mScheduler->getScheduledFrameTime();
- refreshArgs.expectedPresentTime = pacesetterTarget.expectedPresentTime().ns();
+ refreshArgs.expectedPresentTime = expectedPresentTime.ns();
refreshArgs.hasTrustedPresentationListener = mNumTrustedPresentationListeners > 0;
// Store the present time just before calling to the composition engine so we could notify