diff options
author | Lajos Molnar <lajos@google.com> | 2013-05-06 16:23:07 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-05-23 22:21:13 +0000 |
commit | 9e3cb55b8f6f007906872decfe3b8a2541e94dd2 (patch) | |
tree | 77f8cc3eb06588a6982cc5df2fe24c3e3e2b5038 | |
parent | c5d7b7d323bba8772a9005f7d300ad983a04733a (diff) | |
download | frameworks_native-9e3cb55b8f6f007906872decfe3b8a2541e94dd2.zip frameworks_native-9e3cb55b8f6f007906872decfe3b8a2541e94dd2.tar.gz frameworks_native-9e3cb55b8f6f007906872decfe3b8a2541e94dd2.tar.bz2 |
BufferQueue: remove freeAllBuffersExceptHeadLocked()
Now that we are having separate buffer-instances for the buffer-
queue, we can free all buffers; we don't have to keep the head
alive.
Change-Id: I023e9161a2501d99333f8868ce438afa914ec50f
Signed-off-by: Lajos Molnar <lajos@google.com>
Related-to-bug: 7093648
-rw-r--r-- | include/gui/BufferQueue.h | 4 | ||||
-rw-r--r-- | libs/gui/BufferQueue.cpp | 29 |
2 files changed, 5 insertions, 28 deletions
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h index 8475a71..766fa0f 100644 --- a/include/gui/BufferQueue.h +++ b/include/gui/BufferQueue.h @@ -373,10 +373,6 @@ private: // all slots. void freeAllBuffersLocked(); - // freeAllBuffersExceptHeadLocked frees the GraphicBuffer and sync - // resources for all slots except the head of mQueue. - void freeAllBuffersExceptHeadLocked(); - // drainQueueLocked waits for the buffer queue to empty if we're in // synchronous mode, or returns immediately otherwise. It returns NO_INIT // if the BufferQueue is abandoned (consumer disconnected) or disconnected diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 34dbd71..0dab864 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -178,12 +178,10 @@ status_t BufferQueue::setBufferCount(int bufferCount) { } // here we're guaranteed that the client doesn't have dequeued buffers - // and will release all of its buffer references. - // - // XXX: Should this use drainQueueAndFreeBuffersLocked instead? + // and will release all of its buffer references. We don't clear the + // queue, however, so currently queued buffers still get displayed. freeAllBuffersLocked(); mOverrideMaxBufferCount = bufferCount; - mBufferHasBeenQueued = false; mDequeueCondition.broadcast(); listener = mConsumerListener; } // scope for lock @@ -801,9 +799,8 @@ void BufferQueue::freeBufferLocked(int slot) { } void BufferQueue::freeAllBuffersLocked() { - ALOGW_IF(!mQueue.isEmpty(), - "freeAllBuffersLocked called but mQueue is not empty"); - mQueue.clear(); + ALOGD_IF(!mQueue.isEmpty(), + "freeAllBuffersLocked called with non-empty mQueue"); mBufferHasBeenQueued = false; for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { freeBufferLocked(i); @@ -1026,18 +1023,6 @@ status_t BufferQueue::setMaxAcquiredBufferCount(int maxAcquiredBuffers) { return NO_ERROR; } -void BufferQueue::freeAllBuffersExceptHeadLocked() { - // only called if mQueue is not empty - Fifo::iterator front(mQueue.begin()); - mBufferHasBeenQueued = false; - for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { - const BufferSlot &slot = mSlots[i]; - if (slot.mGraphicBuffer == NULL || - slot.mGraphicBuffer->handle != front->mGraphicBuffer->handle) - freeBufferLocked(i); - } -} - status_t BufferQueue::drainQueueLocked() { while (mSynchronousMode && mQueue.size() > 1) { mDequeueCondition.wait(mMutex); @@ -1056,11 +1041,7 @@ status_t BufferQueue::drainQueueLocked() { status_t BufferQueue::drainQueueAndFreeBuffersLocked() { status_t err = drainQueueLocked(); if (err == NO_ERROR) { - if (mQueue.empty()) { - freeAllBuffersLocked(); - } else { - freeAllBuffersExceptHeadLocked(); - } + freeAllBuffersLocked(); } return err; } |