diff options
author | Jesse Hall <jessehall@google.com> | 2012-06-21 11:35:23 -0700 |
---|---|---|
committer | Jesse Hall <jessehall@google.com> | 2012-06-21 11:56:49 -0700 |
commit | a74cbc06493ed941a8a54f2f1d0074f03fc9aafb (patch) | |
tree | f9ece14d0f5b4751cd8085222d4ecdb4ca9cee75 /libs/ui | |
parent | d8e812ce6fe9ae0388e98b08456e1d18b9498239 (diff) | |
download | frameworks_native-a74cbc06493ed941a8a54f2f1d0074f03fc9aafb.zip frameworks_native-a74cbc06493ed941a8a54f2f1d0074f03fc9aafb.tar.gz frameworks_native-a74cbc06493ed941a8a54f2f1d0074f03fc9aafb.tar.bz2 |
Move remaining bits of lockBuffer to dequeueBuffer
FramebufferNativeWindow::dequeueBuffer now waits for the next buffer
to be non-front in addition to being free.
Change-Id: I991f154958cc6b488b1241aba83d1f95a0513b3c
Diffstat (limited to 'libs/ui')
-rw-r--r-- | libs/ui/FramebufferNativeWindow.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index 84cb8f3..5a36c3b 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -237,10 +237,12 @@ int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window, if (self->mBufferHead >= self->mNumBuffers) self->mBufferHead = 0; - // wait for a free buffer - while (!self->mNumFreeBuffers) { + // wait for a free non-front buffer + while (self->mNumFreeBuffers < 2) { self->mCondition.wait(self->mutex); } + ALOG_ASSERT(self->buffers[index] != self->front); + // get this buffer self->mNumFreeBuffers--; self->mCurrentBufferIndex = index; @@ -254,17 +256,6 @@ int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window, int FramebufferNativeWindow::lockBuffer_DEPRECATED(ANativeWindow* window, ANativeWindowBuffer* buffer) { - // XXX: Can this code all get ripped out? Should it move to dequeueBuffer? - FramebufferNativeWindow* self = getSelf(window); - Mutex::Autolock _l(self->mutex); - - const int index = self->mCurrentBufferIndex; - - // wait that the buffer we're locking is not front anymore - while (self->front == buffer) { - self->mCondition.wait(self->mutex); - } - return NO_ERROR; } |