diff options
author | Mathias Agopian <mathias@google.com> | 2010-08-26 17:42:27 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-08-26 17:42:27 -0700 |
commit | 0e7f4292c78ef32643fdb10134e91e84067515fc (patch) | |
tree | 0adbea05f86d2d45179af18b475cab42632bd0cf /libs | |
parent | 404860ee66524767cb5522cc0c0d84d7e1059abe (diff) | |
download | frameworks_native-0e7f4292c78ef32643fdb10134e91e84067515fc.zip frameworks_native-0e7f4292c78ef32643fdb10134e91e84067515fc.tar.gz frameworks_native-0e7f4292c78ef32643fdb10134e91e84067515fc.tar.bz2 |
fix a race in SF buffer management
also remove some unused code.
Change-Id: Iae2c3309b7a08055f3e13a5b866c5c084993e352
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaceflinger_client/SharedBufferStack.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libs/surfaceflinger_client/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp index 4ad9f86..38b2fae 100644 --- a/libs/surfaceflinger_client/SharedBufferStack.cpp +++ b/libs/surfaceflinger_client/SharedBufferStack.cpp @@ -191,12 +191,6 @@ int32_t SharedBufferBase::getIdentity() const return stack.identity; } -size_t SharedBufferBase::getFrontBuffer() const -{ - SharedBufferStack& stack( *mSharedStack ); - return size_t( stack.head ); -} - String8 SharedBufferBase::dump(char const* prefix) const { const size_t SIZE = 1024; @@ -281,6 +275,16 @@ ssize_t SharedBufferClient::QueueUpdate::operator()() { return NO_ERROR; } +SharedBufferClient::DequeueUpdate::DequeueUpdate(SharedBufferBase* sbb) + : UpdateBase(sbb) { +} +ssize_t SharedBufferClient::DequeueUpdate::operator()() { + if (android_atomic_dec(&stack.available) == 0) { + LOGW("dequeue probably called from multiple threads!"); + } + return NO_ERROR; +} + SharedBufferClient::UndoDequeueUpdate::UndoDequeueUpdate(SharedBufferBase* sbb) : UpdateBase(sbb) { } @@ -388,12 +392,8 @@ ssize_t SharedBufferClient::dequeue() if (err != NO_ERROR) return ssize_t(err); - // NOTE: 'stack.available' is part of the conditions, however - // decrementing it, never changes any conditions, so we don't need - // to do this as part of an update. - if (android_atomic_dec(&stack.available) == 0) { - LOGW("dequeue probably called from multiple threads!"); - } + DequeueUpdate update(this); + updateCondition( update ); undoDequeueTail = tail; int dequeued = stack.index[tail]; |