Loading services/surfaceflinger/Scheduler/EventThread.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -235,7 +235,8 @@ binder::Status EventThreadConnection::getLatestVsyncEventData( ParcelableVsyncEventData* outVsyncEventData) { ATRACE_CALL(); outVsyncEventData->vsync = mEventThread->getLatestVsyncEventData(sp<EventThreadConnection>::fromExisting(this)); mEventThread->getLatestVsyncEventData(sp<EventThreadConnection>::fromExisting(this), systemTime()); return binder::Status::ok(); } Loading Loading @@ -387,8 +388,8 @@ void EventThread::requestNextVsync(const sp<EventThreadConnection>& connection) } } VsyncEventData EventThread::getLatestVsyncEventData( const sp<EventThreadConnection>& connection) const { VsyncEventData EventThread::getLatestVsyncEventData(const sp<EventThreadConnection>& connection, nsecs_t now) const { // Resync so that the vsync is accurate with hardware. getLatestVsyncEventData is an alternate // way to get vsync data (instead of posting callbacks to Choreographer). mCallback.resync(); Loading @@ -399,11 +400,10 @@ VsyncEventData EventThread::getLatestVsyncEventData( const auto [presentTime, deadline] = [&]() -> std::pair<nsecs_t, nsecs_t> { std::lock_guard<std::mutex> lock(mMutex); const auto vsyncTime = mVsyncSchedule->getTracker().nextAnticipatedVSyncTimeFrom( systemTime() + mWorkDuration.get().count() + mReadyDuration.count()); now + mWorkDuration.get().count() + mReadyDuration.count()); return {vsyncTime, vsyncTime - mReadyDuration.count()}; }(); generateFrameTimeline(vsyncEventData, frameInterval.ns(), systemTime(SYSTEM_TIME_MONOTONIC), presentTime, deadline); generateFrameTimeline(vsyncEventData, frameInterval.ns(), now, presentTime, deadline); if (FlagManager::getInstance().vrr_config()) { mCallback.onExpectedPresentTimePosted(TimePoint::fromNs(presentTime)); } Loading services/surfaceflinger/Scheduler/EventThread.h +4 −4 Original line number Diff line number Diff line Loading @@ -127,8 +127,8 @@ public: virtual void setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& connection) = 0; // Requests the next vsync. If resetIdleTimer is set to true, it resets the idle timer. virtual void requestNextVsync(const sp<EventThreadConnection>& connection) = 0; virtual VsyncEventData getLatestVsyncEventData( const sp<EventThreadConnection>& connection) const = 0; virtual VsyncEventData getLatestVsyncEventData(const sp<EventThreadConnection>& connection, nsecs_t now) const = 0; virtual void onNewVsyncSchedule(std::shared_ptr<scheduler::VsyncSchedule>) = 0; Loading Loading @@ -160,8 +160,8 @@ public: status_t registerDisplayEventConnection(const sp<EventThreadConnection>& connection) override; void setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& connection) override; void requestNextVsync(const sp<EventThreadConnection>& connection) override; VsyncEventData getLatestVsyncEventData( const sp<EventThreadConnection>& connection) const override; VsyncEventData getLatestVsyncEventData(const sp<EventThreadConnection>& connection, nsecs_t now) const override; void enableSyntheticVsync(bool) override; Loading services/surfaceflinger/tests/unittests/EventThreadTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -493,7 +493,7 @@ TEST_F(EventThreadTest, getLatestVsyncEventData) { EXPECT_CALL(mockTracker, nextAnticipatedVSyncTimeFrom(_, _)) .WillOnce(Return(preferredExpectedPresentationTime)); VsyncEventData vsyncEventData = mThread->getLatestVsyncEventData(mConnection); VsyncEventData vsyncEventData = mThread->getLatestVsyncEventData(mConnection, now); // Check EventThread immediately requested a resync. EXPECT_TRUE(mResyncCallRecorder.waitForCall().has_value()); Loading services/surfaceflinger/tests/unittests/mock/MockEventThread.h +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public: (override)); MOCK_METHOD(void, requestNextVsync, (const sp<android::EventThreadConnection>&), (override)); MOCK_METHOD(VsyncEventData, getLatestVsyncEventData, (const sp<android::EventThreadConnection>&), (const, override)); (const sp<android::EventThreadConnection>&, nsecs_t), (const, override)); MOCK_METHOD(void, requestLatestConfig, (const sp<android::EventThreadConnection>&)); MOCK_METHOD(void, pauseVsyncCallback, (bool)); MOCK_METHOD(void, onNewVsyncSchedule, (std::shared_ptr<scheduler::VsyncSchedule>), (override)); Loading Loading
services/surfaceflinger/Scheduler/EventThread.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -235,7 +235,8 @@ binder::Status EventThreadConnection::getLatestVsyncEventData( ParcelableVsyncEventData* outVsyncEventData) { ATRACE_CALL(); outVsyncEventData->vsync = mEventThread->getLatestVsyncEventData(sp<EventThreadConnection>::fromExisting(this)); mEventThread->getLatestVsyncEventData(sp<EventThreadConnection>::fromExisting(this), systemTime()); return binder::Status::ok(); } Loading Loading @@ -387,8 +388,8 @@ void EventThread::requestNextVsync(const sp<EventThreadConnection>& connection) } } VsyncEventData EventThread::getLatestVsyncEventData( const sp<EventThreadConnection>& connection) const { VsyncEventData EventThread::getLatestVsyncEventData(const sp<EventThreadConnection>& connection, nsecs_t now) const { // Resync so that the vsync is accurate with hardware. getLatestVsyncEventData is an alternate // way to get vsync data (instead of posting callbacks to Choreographer). mCallback.resync(); Loading @@ -399,11 +400,10 @@ VsyncEventData EventThread::getLatestVsyncEventData( const auto [presentTime, deadline] = [&]() -> std::pair<nsecs_t, nsecs_t> { std::lock_guard<std::mutex> lock(mMutex); const auto vsyncTime = mVsyncSchedule->getTracker().nextAnticipatedVSyncTimeFrom( systemTime() + mWorkDuration.get().count() + mReadyDuration.count()); now + mWorkDuration.get().count() + mReadyDuration.count()); return {vsyncTime, vsyncTime - mReadyDuration.count()}; }(); generateFrameTimeline(vsyncEventData, frameInterval.ns(), systemTime(SYSTEM_TIME_MONOTONIC), presentTime, deadline); generateFrameTimeline(vsyncEventData, frameInterval.ns(), now, presentTime, deadline); if (FlagManager::getInstance().vrr_config()) { mCallback.onExpectedPresentTimePosted(TimePoint::fromNs(presentTime)); } Loading
services/surfaceflinger/Scheduler/EventThread.h +4 −4 Original line number Diff line number Diff line Loading @@ -127,8 +127,8 @@ public: virtual void setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& connection) = 0; // Requests the next vsync. If resetIdleTimer is set to true, it resets the idle timer. virtual void requestNextVsync(const sp<EventThreadConnection>& connection) = 0; virtual VsyncEventData getLatestVsyncEventData( const sp<EventThreadConnection>& connection) const = 0; virtual VsyncEventData getLatestVsyncEventData(const sp<EventThreadConnection>& connection, nsecs_t now) const = 0; virtual void onNewVsyncSchedule(std::shared_ptr<scheduler::VsyncSchedule>) = 0; Loading Loading @@ -160,8 +160,8 @@ public: status_t registerDisplayEventConnection(const sp<EventThreadConnection>& connection) override; void setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& connection) override; void requestNextVsync(const sp<EventThreadConnection>& connection) override; VsyncEventData getLatestVsyncEventData( const sp<EventThreadConnection>& connection) const override; VsyncEventData getLatestVsyncEventData(const sp<EventThreadConnection>& connection, nsecs_t now) const override; void enableSyntheticVsync(bool) override; Loading
services/surfaceflinger/tests/unittests/EventThreadTest.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -493,7 +493,7 @@ TEST_F(EventThreadTest, getLatestVsyncEventData) { EXPECT_CALL(mockTracker, nextAnticipatedVSyncTimeFrom(_, _)) .WillOnce(Return(preferredExpectedPresentationTime)); VsyncEventData vsyncEventData = mThread->getLatestVsyncEventData(mConnection); VsyncEventData vsyncEventData = mThread->getLatestVsyncEventData(mConnection, now); // Check EventThread immediately requested a resync. EXPECT_TRUE(mResyncCallRecorder.waitForCall().has_value()); Loading
services/surfaceflinger/tests/unittests/mock/MockEventThread.h +1 −1 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public: (override)); MOCK_METHOD(void, requestNextVsync, (const sp<android::EventThreadConnection>&), (override)); MOCK_METHOD(VsyncEventData, getLatestVsyncEventData, (const sp<android::EventThreadConnection>&), (const, override)); (const sp<android::EventThreadConnection>&, nsecs_t), (const, override)); MOCK_METHOD(void, requestLatestConfig, (const sp<android::EventThreadConnection>&)); MOCK_METHOD(void, pauseVsyncCallback, (bool)); MOCK_METHOD(void, onNewVsyncSchedule, (std::shared_ptr<scheduler::VsyncSchedule>), (override)); Loading