summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueueProducer.cpp
diff options
context:
space:
mode:
author Pablo Ceballos <pceballos@google.com> 2016-06-01 15:03:21 -0700
committer Pablo Ceballos <pceballos@google.com> 2016-06-01 15:03:21 -0700
commit28c65ad1a1bc2cfd232044e9ea704197483cf250 (patch)
tree9ac325a73a26623f4c997b2812bfe303a61c2d8a /libs/gui/BufferQueueProducer.cpp
parente4ecdb66d5c2eed64cbd5b267e0621cab7b8a63b (diff)
BQ: Don't return fences from dequeue in shared buffer mode
Bug 29007505 Change-Id: I112ae6bd64ddc9a923ad9080e85a71adb96146af
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
-rw-r--r--libs/gui/BufferQueueProducer.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 3e26e058fb..69a408c075 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -444,14 +444,6 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot,
mSlots[found].mBufferState.dequeue();
- // If shared buffer mode has just been enabled, cache the slot of the
- // first buffer that is dequeued and mark it as the shared buffer.
- if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot ==
- BufferQueueCore::INVALID_BUFFER_SLOT) {
- mCore->mSharedBufferSlot = found;
- mSlots[found].mBufferState.mShared = true;
- }
-
if ((buffer == NULL) ||
buffer->needsReallocation(width, height, format, usage))
{
@@ -483,9 +475,21 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot,
eglDisplay = mSlots[found].mEglDisplay;
eglFence = mSlots[found].mEglFence;
- *outFence = mSlots[found].mFence;
+ // Don't return a fence in shared buffer mode, except for the first
+ // frame.
+ *outFence = (mCore->mSharedBufferMode &&
+ mCore->mSharedBufferSlot == found) ?
+ Fence::NO_FENCE : mSlots[found].mFence;
mSlots[found].mEglFence = EGL_NO_SYNC_KHR;
mSlots[found].mFence = Fence::NO_FENCE;
+
+ // If shared buffer mode has just been enabled, cache the slot of the
+ // first buffer that is dequeued and mark it as the shared buffer.
+ if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot ==
+ BufferQueueCore::INVALID_BUFFER_SLOT) {
+ mCore->mSharedBufferSlot = found;
+ mSlots[found].mBufferState.mShared = true;
+ }
} // Autolock scope
if (returnFlags & BUFFER_NEEDS_REALLOCATION) {