diff options
| author | 2017-01-18 23:02:36 -0800 | |
|---|---|---|
| committer | 2017-01-20 11:26:13 -0800 | |
| commit | 22f842ba04c32cef2faf855dc304eb0ab131b9ec (patch) | |
| tree | dd6cc0fb014748838c5c39b1b91480999514b96c /libs/gui/BufferQueueProducer.cpp | |
| parent | 90b25ed559f3d04777dbbc195ad5c95287990bf7 (diff) | |
BufferQueue: Add bufferReplaced flag in QueueBufferOutput
For async buffer queue, when queueBuffer overwrites a previously queued
buffer, because consumer won't be able to acquire the overwritten
buffer, onBufferReleased isn't triggered either.
This makes it difficult to track which buffer in the buffer queue
becomes free other than calling dequeueBuffer(). Adding a flag in
QueueBufferOutput addresses this issue.
Test: TestBufferReplacedInQueueBuffer in BufferQueue_tests
Bug: 34481539
Change-Id: Ic7f4be2d3f9691dd6b007a450240614c0c420f0d
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
| -rw-r--r-- | libs/gui/BufferQueueProducer.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 39b9a0b480..3f69b1f602 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -879,6 +879,7 @@ status_t BufferQueueProducer::queueBuffer(int slot, mCore->mSharedBufferCache.dataspace = dataSpace; } + output->bufferReplaced = false; if (mCore->mQueue.empty()) { // When the queue is empty, we can ignore mDequeueBufferCannotBlock // and simply queue this buffer @@ -905,6 +906,7 @@ status_t BufferQueueProducer::queueBuffer(int slot, if (!mSlots[last.mSlot].mBufferState.isShared()) { mCore->mActiveBuffers.erase(last.mSlot); mCore->mFreeBuffers.push_back(last.mSlot); + output->bufferReplaced = true; } } @@ -1158,6 +1160,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, output->numPendingBuffers = static_cast<uint32_t>(mCore->mQueue.size()); output->nextFrameNumber = mCore->mFrameCounter + 1; + output->bufferReplaced = false; if (listener != NULL) { // Set up a death notification so that we can disconnect |