SF: pass a render rate to VsyncTracker instead of a divisor
passing a divisor to VsyncTracker might result in the wrong frame
rate when the vsync period is changing. The Divisor was calculated in
VsyncReactor which calculates it based on the new period, and passed
to VsyncTracker which might still be learning the new period, hence
using the old period.
Bug: 267780202
Test: SF unit tests
Change-Id: Ibb632d4ae6621a6ac0c0123e78f4c4d75699bd9e
diff --git a/services/surfaceflinger/Scheduler/VSyncPredictor.h b/services/surfaceflinger/Scheduler/VSyncPredictor.h
index d0e3098..cd5d9ef 100644
--- a/services/surfaceflinger/Scheduler/VSyncPredictor.h
+++ b/services/surfaceflinger/Scheduler/VSyncPredictor.h
@@ -67,7 +67,7 @@
bool isVSyncInPhase(nsecs_t timePoint, Fps frameRate) const final EXCLUDES(mMutex);
- void setDivisor(unsigned divisor) final EXCLUDES(mMutex);
+ void setRenderRate(Fps) final EXCLUDES(mMutex);
void dump(std::string& result) const final EXCLUDES(mMutex);
@@ -106,7 +106,7 @@
size_t mLastTimestampIndex GUARDED_BY(mMutex) = 0;
std::vector<nsecs_t> mTimestamps GUARDED_BY(mMutex);
- unsigned mDivisor GUARDED_BY(mMutex) = 1;
+ std::optional<Fps> mRenderRate GUARDED_BY(mMutex);
mutable std::optional<VsyncSequence> mLastVsyncSequence GUARDED_BY(mMutex);
};