diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-06-15 15:30:35 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-06-15 15:30:35 -0700 |
commit | 7c24b1d4da5e13329d2105cb2f8285715d920787 (patch) | |
tree | 8158585799401dde7e5dca0f523589c5b981ce9a | |
parent | 16272efb7af0692266fecdc53b2c6d995bf397b7 (diff) | |
parent | 7d886474734623fd2565ff40215ffe497e10b4cc (diff) | |
download | native-7c24b1d4da5e13329d2105cb2f8285715d920787.tar.gz |
Merge "SF could get stuck waiting for vsync when turning the screen off" into jb-dev
-rw-r--r-- | services/surfaceflinger/EventThread.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp index 47fa2f3df1..7c1aebe0b8 100644 --- a/services/surfaceflinger/EventThread.cpp +++ b/services/surfaceflinger/EventThread.cpp @@ -60,7 +60,7 @@ status_t EventThread::registerDisplayEventConnection( const sp<EventThread::Connection>& connection) { Mutex::Autolock _l(mLock); mDisplayEventConnections.add(connection); - mCondition.signal(); + mCondition.broadcast(); return NO_ERROR; } @@ -68,7 +68,7 @@ status_t EventThread::unregisterDisplayEventConnection( const wp<EventThread::Connection>& connection) { Mutex::Autolock _l(mLock); mDisplayEventConnections.remove(connection); - mCondition.signal(); + mCondition.broadcast(); return NO_ERROR; } @@ -85,7 +85,7 @@ void EventThread::setVsyncRate(uint32_t count, const int32_t new_count = (count == 0) ? -1 : count; if (connection->count != new_count) { connection->count = new_count; - mCondition.signal(); + mCondition.broadcast(); } } } @@ -95,32 +95,33 @@ void EventThread::requestNextVsync( Mutex::Autolock _l(mLock); if (connection->count < 0) { connection->count = 0; - mCondition.signal(); + mCondition.broadcast(); } } void EventThread::onScreenReleased() { Mutex::Autolock _l(mLock); - // wait for an eventual pending vsync to be serviced if (!mUseSoftwareVSync) { - while (mVSyncTimestamp) { - mCondition.wait(mLock); - } + // disable reliance on h/w vsync + mUseSoftwareVSync = true; + mCondition.broadcast(); } - // disable reliance on h/w vsync - mUseSoftwareVSync = true; } void EventThread::onScreenAcquired() { Mutex::Autolock _l(mLock); - mUseSoftwareVSync = false; + if (mUseSoftwareVSync) { + // resume use of h/w vsync + mUseSoftwareVSync = false; + mCondition.broadcast(); + } } void EventThread::onVSyncReceived(int, nsecs_t timestamp) { Mutex::Autolock _l(mLock); mVSyncTimestamp = timestamp; - mCondition.signal(); + mCondition.broadcast(); } bool EventThread::threadLoop() { |