summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-07-23 17:28:53 -0700
committerMathias Agopian <mathias@google.com>2013-07-26 18:45:02 -0700
commitad678e18b66f495efa78dc3b9ab99b579945c9e2 (patch)
treeb1158419e04a0417533618592ef58d5fa23490b5 /include
parentbf5b849ec7b2050e1fe05aebb3914823da6a0d07 (diff)
downloadframeworks_native-ad678e18b66f495efa78dc3b9ab99b579945c9e2.zip
frameworks_native-ad678e18b66f495efa78dc3b9ab99b579945c9e2.tar.gz
frameworks_native-ad678e18b66f495efa78dc3b9ab99b579945c9e2.tar.bz2
single buffer mode for BufferQueue
Bug: 9891035 Change-Id: Id1ab5f911a6dc4c1d8235e65775b3d3635231ad4
Diffstat (limited to 'include')
-rw-r--r--include/gui/BufferQueue.h14
-rw-r--r--include/gui/GLConsumer.h13
2 files changed, 25 insertions, 2 deletions
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 @@ public:
// 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 @@ public:
// 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 @@ private:
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.
diff --git a/include/gui/GLConsumer.h b/include/gui/GLConsumer.h
index 1df5b42..ac4a832 100644
--- a/include/gui/GLConsumer.h
+++ b/include/gui/GLConsumer.h
@@ -98,6 +98,13 @@ public:
// This calls doGLFenceWait to ensure proper synchronization.
status_t updateTexImage();
+ // releaseTexImage releases the texture acquired in updateTexImage().
+ // This is intended to be used in single buffer mode.
+ //
+ // This call may only be made while the OpenGL ES context to which the
+ // target texture belongs is bound to the calling thread.
+ status_t releaseTexImage();
+
// setReleaseFence stores a fence that will signal when the current buffer
// is no longer being read. This fence will be returned to the producer
// when the current buffer is released by updateTexImage(). Multiple
@@ -251,7 +258,7 @@ protected:
// This releases the buffer in the slot referenced by mCurrentTexture,
// then updates state to refer to the BufferItem, which must be a
// newly-acquired buffer.
- status_t releaseAndUpdateLocked(const BufferQueue::BufferItem& item);
+ status_t updateAndReleaseLocked(const BufferQueue::BufferItem& item);
// Binds mTexName and the current buffer to mTexTarget. Uses
// mCurrentTexture if it's set, mCurrentTextureBuf if not. If the
@@ -416,6 +423,10 @@ private:
// It is set to false by detachFromContext, and then set to true again by
// attachToContext.
bool mAttached;
+
+ // mReleasedTexImageBuffer is a dummy buffer used when in single buffer
+ // mode and releaseTexImage() has been called
+ sp<GraphicBuffer> mReleasedTexImageBuffer;
};
// ----------------------------------------------------------------------------