single buffer mode for BufferQueue
Bug: 9891035
Change-Id: Id1ab5f911a6dc4c1d8235e65775b3d3635231ad4
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index 628678f..cfce40d 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -340,6 +340,13 @@
// The count must be between 2 and NUM_BUFFER_SLOTS, inclusive.
status_t setDefaultMaxBufferCount(int bufferCount);
+ // disableAsyncBuffer disables the extra buffer used in async mode
+ // (when both producer and consumer have set their "isControlledByApp"
+ // flag) and has dequeueBuffer() return WOULD_BLOCK instead.
+ //
+ // This can only be called before consumerConnect().
+ status_t disableAsyncBuffer();
+
// setMaxAcquiredBufferCount sets the maximum number of buffers that can
// be acquired by the consumer at one time (default 1). This call will
// fail if a producer is connected to the BufferQueue.
@@ -364,6 +371,7 @@
// NATIVE_WINDOW_TRANSFORM_ROT_90. The default is 0 (no transform).
status_t setTransformHint(uint32_t hint);
+
private:
// freeBufferLocked frees the GraphicBuffer and sync resources for the
// given slot.
@@ -559,10 +567,14 @@
bool mConsumerControlledByApp;
// mDequeueBufferCannotBlock whether dequeueBuffer() isn't allowed to block.
- // this flag is set durring connect() when both consumer and producer are controlled
+ // this flag is set during connect() when both consumer and producer are controlled
// by the application.
bool mDequeueBufferCannotBlock;
+ // mUseAsyncBuffer whether an extra buffer is used in async mode to prevent
+ // dequeueBuffer() from ever blocking.
+ bool mUseAsyncBuffer;
+
// mConnectedApi indicates the producer API that is currently connected
// to this BufferQueue. It defaults to NO_CONNECTED_API (= 0), and gets
// updated by the connect and disconnect methods.