SF: pass last vsync to VsyncPredictor
To avoid crossing min frame period on VRR displays, we pass
the last commited vsync and use that as a reference point.
Bug: 313474368
Bug: 316570464
Test: presubmit
Change-Id: I827f5757ab7accb4577b37a5cabb4bd86df82921
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index aa8d54d..d6ec684 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -600,8 +600,10 @@
const Display& display = *displayOpt;
const nsecs_t threshold =
display.selectorPtr->getActiveMode().modePtr->getVsyncRate().getPeriodNsecs() / 2;
- const nsecs_t nextVsyncTime = display.schedulePtr->getTracker().nextAnticipatedVSyncTimeFrom(
- currentExpectedPresentTime.ns() + threshold);
+ const nsecs_t nextVsyncTime =
+ display.schedulePtr->getTracker()
+ .nextAnticipatedVSyncTimeFrom(currentExpectedPresentTime.ns() + threshold,
+ currentExpectedPresentTime.ns());
return Fps::fromPeriodNsecs(nextVsyncTime - currentExpectedPresentTime.ns());
}