Loading libs/gui/DisplayEventDispatcher.cpp +21 −49 Original line number Diff line number Diff line Loading @@ -36,9 +36,7 @@ static const size_t EVENT_BUFFER_SIZE = 100; DisplayEventDispatcher::DisplayEventDispatcher( const sp<Looper>& looper, ISurfaceComposer::VsyncSource vsyncSource, ISurfaceComposer::EventRegistrationFlags eventRegistration) : mLooper(looper), mReceiver(vsyncSource, eventRegistration), mVsyncState(VsyncState::Unregistered) { : mLooper(looper), mReceiver(vsyncSource, eventRegistration), mWaitingForVsync(false) { ALOGV("dispatcher %p ~ Initializing display event dispatcher.", this); } Loading Loading @@ -68,8 +66,7 @@ void DisplayEventDispatcher::dispose() { } status_t DisplayEventDispatcher::scheduleVsync() { switch (mVsyncState) { case VsyncState::Unregistered: { if (!mWaitingForVsync) { ALOGV("dispatcher %p ~ Scheduling vsync.", this); // Drain all pending events. Loading @@ -77,28 +74,18 @@ status_t DisplayEventDispatcher::scheduleVsync() { PhysicalDisplayId vsyncDisplayId; uint32_t vsyncCount; VsyncEventData vsyncEventData; if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncEventData)) { ALOGE("dispatcher %p ~ last event processed while scheduling was for %" PRId64 "", this, ns2ms(static_cast<nsecs_t>(vsyncTimestamp))); if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncEventData)) { ALOGE("dispatcher %p ~ last event processed while scheduling was for %" PRId64 "", this, ns2ms(static_cast<nsecs_t>(vsyncTimestamp))); } status_t status = mReceiver.setVsyncRate(1); status_t status = mReceiver.requestNextVsync(); if (status) { ALOGW("Failed to set vsync rate, status=%d", status); ALOGW("Failed to request next vsync, status=%d", status); return status; } mVsyncState = VsyncState::RegisteredAndWaitingForVsync; break; } case VsyncState::Registered: { mVsyncState = VsyncState::RegisteredAndWaitingForVsync; break; } case VsyncState::RegisteredAndWaitingForVsync: { break; } mWaitingForVsync = true; } return OK; } Loading Loading @@ -136,23 +123,8 @@ int DisplayEventDispatcher::handleEvent(int, int events, void*) { ", displayId=%s, count=%d, vsyncId=%" PRId64, this, ns2ms(vsyncTimestamp), to_string(vsyncDisplayId).c_str(), vsyncCount, vsyncEventData.id); switch (mVsyncState) { case VsyncState::Unregistered: ALOGW("Received unexpected VSYNC event"); break; case VsyncState::RegisteredAndWaitingForVsync: mVsyncState = VsyncState::Registered; mWaitingForVsync = false; dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount, vsyncEventData); break; case VsyncState::Registered: status_t status = mReceiver.setVsyncRate(0); if (status) { ALOGW("Failed to reset vsync rate, status=%d", status); return status; } mVsyncState = VsyncState::Unregistered; break; } } return 1; // keep the callback Loading libs/gui/include/gui/DisplayEventDispatcher.h +1 −14 Original line number Diff line number Diff line Loading @@ -52,20 +52,7 @@ protected: private: sp<Looper> mLooper; DisplayEventReceiver mReceiver; // The state of vsync event registration and whether the client is expecting // an event or not. enum class VsyncState { // The dispatcher is not registered for vsync events. Unregistered, // The dispatcher is registered to receive vsync events but should not dispatch it to the // client as the client is not expecting a vsync event. Registered, // The dispatcher is registered to receive vsync events and supposed to dispatch it to // the client. RegisteredAndWaitingForVsync, }; VsyncState mVsyncState; bool mWaitingForVsync; std::vector<FrameRateOverride> mFrameRateOverrides; Loading services/surfaceflinger/Scheduler/EventThread.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -303,10 +303,6 @@ void EventThread::setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& c std::lock_guard<std::mutex> lock(mMutex); const auto request = rate == 0 ? VSyncRequest::None : static_cast<VSyncRequest>(rate); if (request != VSyncRequest::None && connection->resyncCallback) { connection->resyncCallback(); } if (connection->vsyncRequest != request) { connection->vsyncRequest = request; mCondition.notify_all(); Loading Loading
libs/gui/DisplayEventDispatcher.cpp +21 −49 Original line number Diff line number Diff line Loading @@ -36,9 +36,7 @@ static const size_t EVENT_BUFFER_SIZE = 100; DisplayEventDispatcher::DisplayEventDispatcher( const sp<Looper>& looper, ISurfaceComposer::VsyncSource vsyncSource, ISurfaceComposer::EventRegistrationFlags eventRegistration) : mLooper(looper), mReceiver(vsyncSource, eventRegistration), mVsyncState(VsyncState::Unregistered) { : mLooper(looper), mReceiver(vsyncSource, eventRegistration), mWaitingForVsync(false) { ALOGV("dispatcher %p ~ Initializing display event dispatcher.", this); } Loading Loading @@ -68,8 +66,7 @@ void DisplayEventDispatcher::dispose() { } status_t DisplayEventDispatcher::scheduleVsync() { switch (mVsyncState) { case VsyncState::Unregistered: { if (!mWaitingForVsync) { ALOGV("dispatcher %p ~ Scheduling vsync.", this); // Drain all pending events. Loading @@ -77,28 +74,18 @@ status_t DisplayEventDispatcher::scheduleVsync() { PhysicalDisplayId vsyncDisplayId; uint32_t vsyncCount; VsyncEventData vsyncEventData; if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncEventData)) { ALOGE("dispatcher %p ~ last event processed while scheduling was for %" PRId64 "", this, ns2ms(static_cast<nsecs_t>(vsyncTimestamp))); if (processPendingEvents(&vsyncTimestamp, &vsyncDisplayId, &vsyncCount, &vsyncEventData)) { ALOGE("dispatcher %p ~ last event processed while scheduling was for %" PRId64 "", this, ns2ms(static_cast<nsecs_t>(vsyncTimestamp))); } status_t status = mReceiver.setVsyncRate(1); status_t status = mReceiver.requestNextVsync(); if (status) { ALOGW("Failed to set vsync rate, status=%d", status); ALOGW("Failed to request next vsync, status=%d", status); return status; } mVsyncState = VsyncState::RegisteredAndWaitingForVsync; break; } case VsyncState::Registered: { mVsyncState = VsyncState::RegisteredAndWaitingForVsync; break; } case VsyncState::RegisteredAndWaitingForVsync: { break; } mWaitingForVsync = true; } return OK; } Loading Loading @@ -136,23 +123,8 @@ int DisplayEventDispatcher::handleEvent(int, int events, void*) { ", displayId=%s, count=%d, vsyncId=%" PRId64, this, ns2ms(vsyncTimestamp), to_string(vsyncDisplayId).c_str(), vsyncCount, vsyncEventData.id); switch (mVsyncState) { case VsyncState::Unregistered: ALOGW("Received unexpected VSYNC event"); break; case VsyncState::RegisteredAndWaitingForVsync: mVsyncState = VsyncState::Registered; mWaitingForVsync = false; dispatchVsync(vsyncTimestamp, vsyncDisplayId, vsyncCount, vsyncEventData); break; case VsyncState::Registered: status_t status = mReceiver.setVsyncRate(0); if (status) { ALOGW("Failed to reset vsync rate, status=%d", status); return status; } mVsyncState = VsyncState::Unregistered; break; } } return 1; // keep the callback Loading
libs/gui/include/gui/DisplayEventDispatcher.h +1 −14 Original line number Diff line number Diff line Loading @@ -52,20 +52,7 @@ protected: private: sp<Looper> mLooper; DisplayEventReceiver mReceiver; // The state of vsync event registration and whether the client is expecting // an event or not. enum class VsyncState { // The dispatcher is not registered for vsync events. Unregistered, // The dispatcher is registered to receive vsync events but should not dispatch it to the // client as the client is not expecting a vsync event. Registered, // The dispatcher is registered to receive vsync events and supposed to dispatch it to // the client. RegisteredAndWaitingForVsync, }; VsyncState mVsyncState; bool mWaitingForVsync; std::vector<FrameRateOverride> mFrameRateOverrides; Loading
services/surfaceflinger/Scheduler/EventThread.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -303,10 +303,6 @@ void EventThread::setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& c std::lock_guard<std::mutex> lock(mMutex); const auto request = rate == 0 ? VSyncRequest::None : static_cast<VSyncRequest>(rate); if (request != VSyncRequest::None && connection->resyncCallback) { connection->resyncCallback(); } if (connection->vsyncRequest != request) { connection->vsyncRequest = request; mCondition.notify_all(); Loading