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
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index 3f46460..f9fc6df 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -159,6 +159,7 @@
int dispatchSetSidebandStream(va_list args);
int dispatchSetBuffersDataSpace(va_list args);
int dispatchSetSurfaceDamage(va_list args);
+ int dispatchSetSingleBufferMode(va_list args);
protected:
virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
@@ -188,6 +189,7 @@
public:
virtual int setMaxDequeuedBufferCount(int maxDequeuedBuffers);
virtual int setAsyncMode(bool async);
+ virtual int setSingleBufferMode(bool singleBufferMode);
virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds);
virtual int unlockAndPost();