Loading services/surfaceflinger/Scheduler/VSyncReactor.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -87,4 +87,12 @@ nsecs_t VSyncReactor::expectedPresentTime() { return mTracker->nextAnticipatedVSyncTimeFrom(mClock->now()); } void VSyncReactor::setPeriod(nsecs_t period) { mTracker->setPeriod(period); } nsecs_t VSyncReactor::getPeriod() { return mTracker->currentPeriod(); } } // namespace android::scheduler services/surfaceflinger/Scheduler/VSyncReactor.h +3 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ public: 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; Loading services/surfaceflinger/Scheduler/VSyncTracker.h +7 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,13 @@ public: */ 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; Loading services/surfaceflinger/tests/unittests/VSyncDispatchRealtimeTest.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ public: nsecs_t currentPeriod() const final { return mPeriod; } void setPeriod(nsecs_t) final {} private: nsecs_t const mPeriod; }; Loading Loading @@ -80,6 +82,8 @@ public: return mPeriod; } void setPeriod(nsecs_t) final {} private: std::mutex mutable mMutex; nsecs_t mPeriod; Loading services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public: MOCK_METHOD1(addVsyncTimestamp, void(nsecs_t)); MOCK_CONST_METHOD1(nextAnticipatedVSyncTimeFrom, nsecs_t(nsecs_t)); MOCK_CONST_METHOD0(currentPeriod, nsecs_t()); MOCK_METHOD1(setPeriod, void(nsecs_t)); nsecs_t nextVSyncTime(nsecs_t timePoint) const { if (timePoint % mPeriod == 0) { Loading Loading
services/surfaceflinger/Scheduler/VSyncReactor.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -87,4 +87,12 @@ nsecs_t VSyncReactor::expectedPresentTime() { return mTracker->nextAnticipatedVSyncTimeFrom(mClock->now()); } void VSyncReactor::setPeriod(nsecs_t period) { mTracker->setPeriod(period); } nsecs_t VSyncReactor::getPeriod() { return mTracker->currentPeriod(); } } // namespace android::scheduler
services/surfaceflinger/Scheduler/VSyncReactor.h +3 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,9 @@ public: 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; Loading
services/surfaceflinger/Scheduler/VSyncTracker.h +7 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,13 @@ public: */ 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; Loading
services/surfaceflinger/tests/unittests/VSyncDispatchRealtimeTest.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ public: nsecs_t currentPeriod() const final { return mPeriod; } void setPeriod(nsecs_t) final {} private: nsecs_t const mPeriod; }; Loading Loading @@ -80,6 +82,8 @@ public: return mPeriod; } void setPeriod(nsecs_t) final {} private: std::mutex mutable mMutex; nsecs_t mPeriod; Loading
services/surfaceflinger/tests/unittests/VSyncDispatchTimerQueueTest.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ public: MOCK_METHOD1(addVsyncTimestamp, void(nsecs_t)); MOCK_CONST_METHOD1(nextAnticipatedVSyncTimeFrom, nsecs_t(nsecs_t)); MOCK_CONST_METHOD0(currentPeriod, nsecs_t()); MOCK_METHOD1(setPeriod, void(nsecs_t)); nsecs_t nextVSyncTime(nsecs_t timePoint) const { if (timePoint % mPeriod == 0) { Loading