Add optional parameter to IVsyncSource::vsyncDeadlineAfter
vsyncDeadlineAfter just forwards its parameter to
VSyncTracker::nextAnticipatedVSyncTimeFrom, but the latter has an
optional parameter, too. Adding the optional parameter to
vsyncDeadlineAfter allows Scheduler::getNextFrameInterval to call it
directly. This will further help to move getNextFrameInterval's impl
into FrameTargeter::beginFrame, in
I229e09ccd760341268423fd4ba1ecc5105186f10.
Use Android's TimePoint and related classes directly in
getNextFrameInterval.
Bug: 315371484
Test: atest libscheduler_test:SchedulerTest#nextFrameIntervalTest
Change-Id: I1ede36d692b82a1f7276071fa558decced743334
diff --git a/services/surfaceflinger/Scheduler/VsyncSchedule.cpp b/services/surfaceflinger/Scheduler/VsyncSchedule.cpp
index db6a187..3491600 100644
--- a/services/surfaceflinger/Scheduler/VsyncSchedule.cpp
+++ b/services/surfaceflinger/Scheduler/VsyncSchedule.cpp
@@ -89,8 +89,12 @@
return period();
}
-TimePoint VsyncSchedule::vsyncDeadlineAfter(TimePoint timePoint) const {
- return TimePoint::fromNs(mTracker->nextAnticipatedVSyncTimeFrom(timePoint.ns()));
+TimePoint VsyncSchedule::vsyncDeadlineAfter(TimePoint timePoint,
+ ftl::Optional<TimePoint> lastVsyncOpt) const {
+ return TimePoint::fromNs(
+ mTracker->nextAnticipatedVSyncTimeFrom(timePoint.ns(),
+ lastVsyncOpt.transform(
+ [](TimePoint t) { return t.ns(); })));
}
void VsyncSchedule::dump(std::string& out) const {