diff options
9 files changed, 1 insertions, 80 deletions
diff --git a/services/surfaceflinger/Scheduler/DispSyncSource.cpp b/services/surfaceflinger/Scheduler/DispSyncSource.cpp index 6e89648bdd..00948aedb4 100644 --- a/services/surfaceflinger/Scheduler/DispSyncSource.cpp +++ b/services/surfaceflinger/Scheduler/DispSyncSource.cpp @@ -87,19 +87,7 @@ void DispSyncSource::setPhaseOffset(nsecs_t phaseOffset) { } } -void DispSyncSource::pauseVsyncCallback(bool pause) { - std::lock_guard lock(mVsyncMutex); - mCallbackPaused = pause; -} - void DispSyncSource::onDispSyncEvent(nsecs_t when) { - { - std::lock_guard lock(mVsyncMutex); - if (mCallbackPaused) { - return; - } - } - VSyncSource::Callback* callback; { std::lock_guard lock(mCallbackMutex); diff --git a/services/surfaceflinger/Scheduler/DispSyncSource.h b/services/surfaceflinger/Scheduler/DispSyncSource.h index 2858678108..4759699c5e 100644 --- a/services/surfaceflinger/Scheduler/DispSyncSource.h +++ b/services/surfaceflinger/Scheduler/DispSyncSource.h @@ -33,7 +33,6 @@ public: void setVSyncEnabled(bool enable) override; void setCallback(VSyncSource::Callback* callback) override; void setPhaseOffset(nsecs_t phaseOffset) override; - void pauseVsyncCallback(bool pause) override; private: // The following method is the implementation of the DispSync::Callback. @@ -55,7 +54,6 @@ private: std::mutex mVsyncMutex; nsecs_t mPhaseOffset GUARDED_BY(mVsyncMutex); bool mEnabled GUARDED_BY(mVsyncMutex) = false; - bool mCallbackPaused GUARDED_BY(mVsyncMutex) = false; }; } // namespace android
\ No newline at end of file diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp index a760079069..a6c7e6ce65 100644 --- a/services/surfaceflinger/Scheduler/EventThread.cpp +++ b/services/surfaceflinger/Scheduler/EventThread.cpp @@ -210,12 +210,6 @@ void EventThread::setPhaseOffset(nsecs_t phaseOffset) { mVSyncSource->setPhaseOffset(phaseOffset); } -void EventThread::pauseVsyncCallback(bool pause) { - std::lock_guard<std::mutex> lock(mMutex); - ATRACE_INT("vsyncPaused", pause); - mVSyncSource->pauseVsyncCallback(pause); -} - sp<EventThreadConnection> EventThread::createEventConnection( ResyncCallback resyncCallback, ResetIdleTimerCallback resetIdleTimerCallback) const { return new EventThreadConnection(const_cast<EventThread*>(this), std::move(resyncCallback), diff --git a/services/surfaceflinger/Scheduler/EventThread.h b/services/surfaceflinger/Scheduler/EventThread.h index 67e6de9ce2..7107d6388a 100644 --- a/services/surfaceflinger/Scheduler/EventThread.h +++ b/services/surfaceflinger/Scheduler/EventThread.h @@ -66,9 +66,6 @@ public: virtual void setVSyncEnabled(bool enable) = 0; virtual void setCallback(Callback* callback) = 0; virtual void setPhaseOffset(nsecs_t phaseOffset) = 0; - - // pause/resume vsync callback generation - virtual void pauseVsyncCallback(bool pause) = 0; }; class EventThreadConnection : public BnDisplayEventConnection { @@ -125,8 +122,6 @@ public: // Requests the next vsync. If resetIdleTimer is set to true, it resets the idle timer. virtual void requestNextVsync(const sp<EventThreadConnection>& connection, bool resetIdleTimer) = 0; - - virtual void pauseVsyncCallback(bool pause) = 0; }; namespace impl { @@ -162,8 +157,6 @@ public: void setPhaseOffset(nsecs_t phaseOffset) override; - void pauseVsyncCallback(bool pause) override; - private: friend EventThreadTest; diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp index b1c39ef906..1e55aa6e7b 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.cpp +++ b/services/surfaceflinger/Scheduler/Scheduler.cpp @@ -178,12 +178,6 @@ void Scheduler::setPhaseOffset(const sp<Scheduler::ConnectionHandle>& handle, ns mConnections[handle->id]->thread->setPhaseOffset(phaseOffset); } -void Scheduler::pauseVsyncCallback(const android::sp<android::Scheduler::ConnectionHandle>& handle, - bool pause) { - RETURN_IF_INVALID(); - mConnections[handle->id]->thread->pauseVsyncCallback(pause); -} - void Scheduler::getDisplayStatInfo(DisplayStatInfo* stats) { stats->vsyncTime = mPrimaryDispSync->computeNextRefresh(0); stats->vsyncPeriod = mPrimaryDispSync->getPeriod(); diff --git a/services/surfaceflinger/Scheduler/Scheduler.h b/services/surfaceflinger/Scheduler/Scheduler.h index 1318fbb9c8..e27aa4f8a4 100644 --- a/services/surfaceflinger/Scheduler/Scheduler.h +++ b/services/surfaceflinger/Scheduler/Scheduler.h @@ -131,9 +131,6 @@ public: // Offers ability to modify phase offset in the event thread. void setPhaseOffset(const sp<ConnectionHandle>& handle, nsecs_t phaseOffset); - // pause/resume vsync callback generation to avoid sending vsync callbacks during config switch - void pauseVsyncCallback(const sp<ConnectionHandle>& handle, bool pause); - void getDisplayStatInfo(DisplayStatInfo* stats); void enableHardwareVsync(); diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index bd3f156b82..6e05a19ad7 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -922,9 +922,6 @@ void SurfaceFlinger::setDesiredActiveConfig(const ActiveConfigInfo& info) { mDesiredActiveConfig.event = mDesiredActiveConfig.event | prevConfig; if (!mDesiredActiveConfigChanged) { - // This is the first time we set the desired - mScheduler->pauseVsyncCallback(mAppConnectionHandle, true); - // This will trigger HWC refresh without resetting the idle timer. repaintEverythingForHWC(); } @@ -1000,8 +997,6 @@ bool SurfaceFlinger::performSetActiveConfig() { // display is not valid or we are already in the requested mode // on both cases there is nothing left to do std::lock_guard<std::mutex> lock(mActiveConfigLock); - mScheduler->pauseVsyncCallback(mAppConnectionHandle, false); - mDesiredActiveConfig.event = Scheduler::ConfigEvent::None; mDesiredActiveConfigChanged = false; ATRACE_INT("DesiredActiveConfigChanged", mDesiredActiveConfigChanged); return false; @@ -1012,6 +1007,7 @@ bool SurfaceFlinger::performSetActiveConfig() { // Make sure the desired config is still allowed if (!isDisplayConfigAllowed(desiredActiveConfig.configId)) { std::lock_guard<std::mutex> lock(mActiveConfigLock); + mDesiredActiveConfig.event = Scheduler::ConfigEvent::None; mDesiredActiveConfig.configId = display->getActiveConfig(); return false; } diff --git a/services/surfaceflinger/tests/unittests/DispSyncSourceTest.cpp b/services/surfaceflinger/tests/unittests/DispSyncSourceTest.cpp index 92bdebd400..2e705dad6d 100644 --- a/services/surfaceflinger/tests/unittests/DispSyncSourceTest.cpp +++ b/services/surfaceflinger/tests/unittests/DispSyncSourceTest.cpp @@ -142,23 +142,5 @@ TEST_F(DispSyncSourceTest, waitForCallbacksWithPhaseChange) { } } -TEST_F(DispSyncSourceTest, pauseCallbacks) { - createDispSyncSource(); - EXPECT_TRUE(mDispSyncSource); - - mDispSyncSource->setVSyncEnabled(true); - EXPECT_EQ(mDispSync->getCallbackPhase(), mPhaseOffset.count()); - mDispSync->triggerCallback(); - EXPECT_TRUE(mVSyncEventCallRecorder.waitForCall().has_value()); - - mDispSyncSource->pauseVsyncCallback(true); - mDispSync->triggerCallback(); - EXPECT_FALSE(mVSyncEventCallRecorder.waitForUnexpectedCall().has_value()); - - mDispSyncSource->pauseVsyncCallback(false); - mDispSync->triggerCallback(); - EXPECT_TRUE(mVSyncEventCallRecorder.waitForUnexpectedCall().has_value()); -} - } // namespace } // namespace android diff --git a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp index 249c78f09c..83a92c8691 100644 --- a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp +++ b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp @@ -73,7 +73,6 @@ protected: void expectVSyncSetEnabledCallReceived(bool expectedState); void expectVSyncSetPhaseOffsetCallReceived(nsecs_t expectedPhaseOffset); - void expectVSyncPauseVsyncCallbackCallReceived(bool expectedPause); VSyncSource::Callback* expectVSyncSetCallbackCallReceived(); void expectInterceptCallReceived(nsecs_t expectedTimestamp); void expectVsyncEventReceivedByConnection(const char* name, @@ -88,7 +87,6 @@ protected: AsyncCallRecorder<void (*)(bool)> mVSyncSetEnabledCallRecorder; AsyncCallRecorder<void (*)(VSyncSource::Callback*)> mVSyncSetCallbackCallRecorder; AsyncCallRecorder<void (*)(nsecs_t)> mVSyncSetPhaseOffsetCallRecorder; - AsyncCallRecorder<void (*)(bool)> mVSyncPauseVsyncCallbackCallRecorder; AsyncCallRecorder<void (*)()> mResyncCallRecorder; AsyncCallRecorder<void (*)()> mResetIdleTimerCallRecorder; AsyncCallRecorder<void (*)(nsecs_t)> mInterceptVSyncCallRecorder; @@ -114,9 +112,6 @@ EventThreadTest::EventThreadTest() { EXPECT_CALL(mVSyncSource, setPhaseOffset(_)) .WillRepeatedly(Invoke(mVSyncSetPhaseOffsetCallRecorder.getInvocable())); - EXPECT_CALL(mVSyncSource, pauseVsyncCallback(_)) - .WillRepeatedly(Invoke(mVSyncPauseVsyncCallbackCallRecorder.getInvocable())); - createThread(); mConnection = createConnection(mConnectionEventCallRecorder); @@ -166,12 +161,6 @@ void EventThreadTest::expectVSyncSetPhaseOffsetCallReceived(nsecs_t expectedPhas EXPECT_EQ(expectedPhaseOffset, std::get<0>(args.value())); } -void EventThreadTest::expectVSyncPauseVsyncCallbackCallReceived(bool expectedPause) { - auto args = mVSyncPauseVsyncCallbackCallRecorder.waitForCall(); - ASSERT_TRUE(args.has_value()); - EXPECT_EQ(expectedPause, std::get<0>(args.value())); -} - VSyncSource::Callback* EventThreadTest::expectVSyncSetCallbackCallReceived() { auto callbackSet = mVSyncSetCallbackCallRecorder.waitForCall(); return callbackSet.has_value() ? std::get<0>(callbackSet.value()) : nullptr; @@ -431,16 +420,6 @@ TEST_F(EventThreadTest, setPhaseOffsetForwardsToVSyncSource) { expectVSyncSetPhaseOffsetCallReceived(321); } -TEST_F(EventThreadTest, pauseVsyncCallbackForwardsToVSyncSource) { - mThread->pauseVsyncCallback(true); - expectVSyncPauseVsyncCallbackCallReceived(true); -} - -TEST_F(EventThreadTest, resumeVsyncCallbackForwardsToVSyncSource) { - mThread->pauseVsyncCallback(false); - expectVSyncPauseVsyncCallbackCallReceived(false); -} - TEST_F(EventThreadTest, postHotplugInternalDisconnect) { mThread->onHotplugReceived(INTERNAL_DISPLAY_ID, false); expectHotplugEventReceivedByConnection(INTERNAL_DISPLAY_ID, false); |