diff options
author | Mathias Agopian <mathias@google.com> | 2010-08-27 16:18:12 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-08-27 16:18:12 -0700 |
commit | 54c4bf27437b8d7f8d2a494acd9de53d55696dea (patch) | |
tree | 0045c300c5f2cbd1ddb2756a31f79b80fa7b0eb3 /libs/surfaceflinger_client | |
parent | 4dcea37d48cc25d5e5e5cc56f7ca3d90d4efd49d (diff) | |
parent | d322d16323176ddd5fef3383798176f64d0078c8 (diff) | |
download | frameworks_base-54c4bf27437b8d7f8d2a494acd9de53d55696dea.zip frameworks_base-54c4bf27437b8d7f8d2a494acd9de53d55696dea.tar.gz frameworks_base-54c4bf27437b8d7f8d2a494acd9de53d55696dea.tar.bz2 |
am d322d163: am ae66946b: Merge "fix a race in SF buffer management" into gingerbread
Merge commit 'd322d16323176ddd5fef3383798176f64d0078c8'
* commit 'd322d16323176ddd5fef3383798176f64d0078c8':
fix a race in SF buffer management
Diffstat (limited to 'libs/surfaceflinger_client')
-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 4c01cd2..a43b440 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) { } @@ -383,12 +387,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]; |