Loading services/surfaceflinger/Scheduler/VSyncReactor.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,11 @@ bool VSyncReactor::addHwVsyncTimestamp(nsecs_t timestamp, std::optional<nsecs_t> mMoreSamplesNeeded = mTracker.needsMoreSamples(); } if (mExternalIgnoreFences) { // keep HWVSync on as long as we ignore present fences. mMoreSamplesNeeded = true; } if (!mMoreSamplesNeeded) { setIgnorePresentFencesInternal(false); } Loading services/surfaceflinger/tests/unittests/VSyncReactorTest.cpp +6 −10 Original line number Diff line number Diff line Loading @@ -195,9 +195,7 @@ TEST_F(VSyncReactorTest, ignoresPresentFencesWhenToldTo) { TEST_F(VSyncReactorTest, ignoresProperlyAfterAPeriodConfirmation) { bool periodFlushed = true; EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(2); mReactor.setIgnorePresentFences(true); EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(3); nsecs_t const newPeriod = 5000; mReactor.onDisplayModeChanged(displayMode(newPeriod), false); Loading @@ -207,7 +205,7 @@ TEST_F(VSyncReactorTest, ignoresProperlyAfterAPeriodConfirmation) { EXPECT_FALSE(mReactor.addHwVsyncTimestamp(newPeriod, std::nullopt, &periodFlushed)); EXPECT_TRUE(periodFlushed); EXPECT_TRUE(mReactor.addPresentFence(generateSignalledFenceWithTime(0))); EXPECT_FALSE(mReactor.addPresentFence(generateSignalledFenceWithTime(0))); } TEST_F(VSyncReactorTest, setPeriodCalledOnceConfirmedChange) { Loading Loading @@ -463,8 +461,7 @@ TEST_F(VSyncReactorTest, hwVsyncIsRequestedForTrackerMultiplePeriodChanges) { TEST_F(VSyncReactorTest, periodChangeWithGivenVsyncPeriod) { bool periodFlushed = true; EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(2); mReactor.setIgnorePresentFences(true); EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(3); nsecs_t const newPeriod = 5000; mReactor.onDisplayModeChanged(displayMode(newPeriod), false); Loading @@ -476,7 +473,7 @@ TEST_F(VSyncReactorTest, periodChangeWithGivenVsyncPeriod) { EXPECT_FALSE(mReactor.addHwVsyncTimestamp(newPeriod, newPeriod, &periodFlushed)); EXPECT_TRUE(periodFlushed); EXPECT_TRUE(mReactor.addPresentFence(generateSignalledFenceWithTime(0))); EXPECT_FALSE(mReactor.addPresentFence(generateSignalledFenceWithTime(0))); } TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) { Loading @@ -486,8 +483,7 @@ TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) { *mMockTracker, kPendingLimit, true /* supportKernelIdleTimer */); bool periodFlushed = true; EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(4); idleReactor.setIgnorePresentFences(true); EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(5); // First, set the same period, which should only be confirmed when we receive two // matching callbacks Loading @@ -512,7 +508,7 @@ TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) { EXPECT_FALSE(idleReactor.addHwVsyncTimestamp(20000, 5000, &periodFlushed)); EXPECT_TRUE(periodFlushed); EXPECT_TRUE(idleReactor.addPresentFence(generateSignalledFenceWithTime(0))); EXPECT_FALSE(idleReactor.addPresentFence(generateSignalledFenceWithTime(0))); } } // namespace android::scheduler Loading Loading
services/surfaceflinger/Scheduler/VSyncReactor.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,11 @@ bool VSyncReactor::addHwVsyncTimestamp(nsecs_t timestamp, std::optional<nsecs_t> mMoreSamplesNeeded = mTracker.needsMoreSamples(); } if (mExternalIgnoreFences) { // keep HWVSync on as long as we ignore present fences. mMoreSamplesNeeded = true; } if (!mMoreSamplesNeeded) { setIgnorePresentFencesInternal(false); } Loading
services/surfaceflinger/tests/unittests/VSyncReactorTest.cpp +6 −10 Original line number Diff line number Diff line Loading @@ -195,9 +195,7 @@ TEST_F(VSyncReactorTest, ignoresPresentFencesWhenToldTo) { TEST_F(VSyncReactorTest, ignoresProperlyAfterAPeriodConfirmation) { bool periodFlushed = true; EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(2); mReactor.setIgnorePresentFences(true); EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(3); nsecs_t const newPeriod = 5000; mReactor.onDisplayModeChanged(displayMode(newPeriod), false); Loading @@ -207,7 +205,7 @@ TEST_F(VSyncReactorTest, ignoresProperlyAfterAPeriodConfirmation) { EXPECT_FALSE(mReactor.addHwVsyncTimestamp(newPeriod, std::nullopt, &periodFlushed)); EXPECT_TRUE(periodFlushed); EXPECT_TRUE(mReactor.addPresentFence(generateSignalledFenceWithTime(0))); EXPECT_FALSE(mReactor.addPresentFence(generateSignalledFenceWithTime(0))); } TEST_F(VSyncReactorTest, setPeriodCalledOnceConfirmedChange) { Loading Loading @@ -463,8 +461,7 @@ TEST_F(VSyncReactorTest, hwVsyncIsRequestedForTrackerMultiplePeriodChanges) { TEST_F(VSyncReactorTest, periodChangeWithGivenVsyncPeriod) { bool periodFlushed = true; EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(2); mReactor.setIgnorePresentFences(true); EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(3); nsecs_t const newPeriod = 5000; mReactor.onDisplayModeChanged(displayMode(newPeriod), false); Loading @@ -476,7 +473,7 @@ TEST_F(VSyncReactorTest, periodChangeWithGivenVsyncPeriod) { EXPECT_FALSE(mReactor.addHwVsyncTimestamp(newPeriod, newPeriod, &periodFlushed)); EXPECT_TRUE(periodFlushed); EXPECT_TRUE(mReactor.addPresentFence(generateSignalledFenceWithTime(0))); EXPECT_FALSE(mReactor.addPresentFence(generateSignalledFenceWithTime(0))); } TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) { Loading @@ -486,8 +483,7 @@ TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) { *mMockTracker, kPendingLimit, true /* supportKernelIdleTimer */); bool periodFlushed = true; EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(4); idleReactor.setIgnorePresentFences(true); EXPECT_CALL(*mMockTracker, addVsyncTimestamp(_)).Times(5); // First, set the same period, which should only be confirmed when we receive two // matching callbacks Loading @@ -512,7 +508,7 @@ TEST_F(VSyncReactorTest, periodIsMeasuredIfIgnoringComposer) { EXPECT_FALSE(idleReactor.addHwVsyncTimestamp(20000, 5000, &periodFlushed)); EXPECT_TRUE(periodFlushed); EXPECT_TRUE(idleReactor.addPresentFence(generateSignalledFenceWithTime(0))); EXPECT_FALSE(idleReactor.addPresentFence(generateSignalledFenceWithTime(0))); } } // namespace android::scheduler Loading