Merge "BQ: Don\'t return fences from dequeue in shared buffer mode" into nyc-dev am: eb6377eb13
am: 907e94d3da
* commit '907e94d3da1215328fe3a5020cd5005e42499eba':
BQ: Don't return fences from dequeue in shared buffer mode
Change-Id: I1a2dbf037ada7477838b3935d3084d1fea6bd09c
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 65f8255..07cfb4f 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -444,14 +444,6 @@
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 @@
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) {