SF: VSyncReactor add period modification functions
Adds 2 more functions from the DispSync interface to VSyncReactor,
{get,set}Period
Bug: 140303479
Test: 2 new units
Change-Id: Ie0084597c80d6d43099201fb49b71ae9badea3ee
diff --git a/services/surfaceflinger/Scheduler/VSyncReactor.cpp b/services/surfaceflinger/Scheduler/VSyncReactor.cpp
index 9ce440c..6588d1b 100644
--- a/services/surfaceflinger/Scheduler/VSyncReactor.cpp
+++ b/services/surfaceflinger/Scheduler/VSyncReactor.cpp
@@ -87,4 +87,12 @@
return mTracker->nextAnticipatedVSyncTimeFrom(mClock->now());
}
+void VSyncReactor::setPeriod(nsecs_t period) {
+ mTracker->setPeriod(period);
+}
+
+nsecs_t VSyncReactor::getPeriod() {
+ return mTracker->currentPeriod();
+}
+
} // namespace android::scheduler
diff --git a/services/surfaceflinger/Scheduler/VSyncReactor.h b/services/surfaceflinger/Scheduler/VSyncReactor.h
index 8436e8a..73a09f1 100644
--- a/services/surfaceflinger/Scheduler/VSyncReactor.h
+++ b/services/surfaceflinger/Scheduler/VSyncReactor.h
@@ -40,6 +40,9 @@
nsecs_t computeNextRefresh(int periodOffset) const;
nsecs_t expectedPresentTime();
+ void setPeriod(nsecs_t period);
+ nsecs_t getPeriod();
+
private:
std::unique_ptr<Clock> const mClock;
std::unique_ptr<VSyncDispatch> const mDispatch;
diff --git a/services/surfaceflinger/Scheduler/VSyncTracker.h b/services/surfaceflinger/Scheduler/VSyncTracker.h
index 335042d..6be63fe 100644
--- a/services/surfaceflinger/Scheduler/VSyncTracker.h
+++ b/services/surfaceflinger/Scheduler/VSyncTracker.h
@@ -54,6 +54,13 @@
*/
virtual nsecs_t currentPeriod() const = 0;
+ /*
+ * Inform the tracker that the period is changing and the tracker needs to recalibrate itself.
+ *
+ * \param [in] period The period that the system is changing into.
+ */
+ virtual void setPeriod(nsecs_t period) = 0;
+
protected:
VSyncTracker(VSyncTracker const&) = delete;
VSyncTracker& operator=(VSyncTracker const&) = delete;