diff options
author | 2015-10-07 15:05:45 -0700 | |
---|---|---|
committer | 2015-11-03 12:03:51 -0800 | |
commit | ccdfd60d79a8b7f1ed6401d0f2e8e29166a10584 (patch) | |
tree | 337134c63442b7f737caf43ff44487b0916f9047 /libs/gui/GLConsumer.cpp | |
parent | c899c322ab49639c1e1b012bb5a8b7d52f8497f4 (diff) |
BQ: Add support for single buffer mode
- Adds a single buffer mode to BufferQueue. In this mode designate the
first dequeued buffer as the shared buffer. All calls to dequeue()
and acquire() will then return the shared buffer, allowing the
producer and consumer to share it.
- Modify the buffer slot state tracking. Add a new SHARED state for
the shared buffer in single buffer mode. Also track how many times
a buffer has been dequeued/queued/acquired as it's possible for a
shared buffer to be both dequeued and acquired at the same time, or
dequeued/acquired multiple times. This tracking is needed to know
when to drop the buffer out of the SHARED state after single buffer
mode has been disabled.
- Add plumbing for enabling/disabling single buffer mode from Surface.
Bug 24940410
Change-Id: I3fc550c74bacb5523c049a227111356257386853
Diffstat (limited to 'libs/gui/GLConsumer.cpp')
-rw-r--r-- | libs/gui/GLConsumer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp index 1572a89222..83e4d66412 100644 --- a/libs/gui/GLConsumer.cpp +++ b/libs/gui/GLConsumer.cpp @@ -424,6 +424,11 @@ status_t GLConsumer::updateAndReleaseLocked(const BufferItem& item) mCurrentTextureImage->graphicBufferHandle() : 0, slot, mSlots[slot].mGraphicBuffer->handle); + // Hang onto the pointer so that it isn't freed in the call to + // releaseBufferLocked() if we're in single buffer mode and both buffers are + // the same. + sp<EglImage> nextTextureImage = mEglSlots[slot].mEglImage; + // release old buffer if (mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) { status_t status = releaseBufferLocked( @@ -439,7 +444,7 @@ status_t GLConsumer::updateAndReleaseLocked(const BufferItem& item) // Update the GLConsumer state. mCurrentTexture = slot; - mCurrentTextureImage = mEglSlots[slot].mEglImage; + mCurrentTextureImage = nextTextureImage; mCurrentCrop = item.mCrop; mCurrentTransform = item.mTransform; mCurrentScalingMode = item.mScalingMode; |