summaryrefslogtreecommitdiffstats
path: root/include/gui/BufferQueueProducer.h
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2014-03-06 15:14:33 -0800
committerDan Stoza <stoza@google.com>2014-03-10 16:45:38 -0700
commit9f3053de78630815d60cf48a2cf2348cc5867c45 (patch)
treee87e2a86d1ca837a80fc7730daece3f28a41e800 /include/gui/BufferQueueProducer.h
parent544b09523b791935ffe9aa64d1f20335f7e2dc78 (diff)
downloadframeworks_native-9f3053de78630815d60cf48a2cf2348cc5867c45.zip
frameworks_native-9f3053de78630815d60cf48a2cf2348cc5867c45.tar.gz
frameworks_native-9f3053de78630815d60cf48a2cf2348cc5867c45.tar.bz2
BufferQueue: Allow detaching/reattaching buffers
Adds detachBuffer and attachBuffer calls to both the producer and consumer sides of BufferQueue. Buffers may be detached while dequeued by the producer or acquired by the consumer, and when attached, enter the dequeued and acquired states, respectively. Bug: 13173343 Change-Id: Ic152692b0a94d99e0135b9bfa62747dab2a54220
Diffstat (limited to 'include/gui/BufferQueueProducer.h')
-rw-r--r--include/gui/BufferQueueProducer.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h
index 8912097..2eeb979 100644
--- a/include/gui/BufferQueueProducer.h
+++ b/include/gui/BufferQueueProducer.h
@@ -96,6 +96,12 @@ public:
virtual status_t dequeueBuffer(int *outSlot, sp<Fence>* outFence, bool async,
uint32_t width, uint32_t height, uint32_t format, uint32_t usage);
+ // See IGraphicBufferProducer::detachBuffer
+ virtual status_t detachBuffer(int slot);
+
+ // See IGraphicBufferProducer::attachBuffer
+ virtual status_t attachBuffer(int* outSlot, const sp<GraphicBuffer>& buffer);
+
// queueBuffer returns a filled buffer to the BufferQueue.
//
// Additional data is provided in the QueueBufferInput struct. Notably,
@@ -151,6 +157,14 @@ private:
// This is required by the IBinder::DeathRecipient interface
virtual void binderDied(const wp<IBinder>& who);
+ // waitForFreeSlotThenRelock finds the oldest slot in the FREE state. It may
+ // block if there are no available slots and we are not in non-blocking
+ // mode (producer and consumer controlled by the application). If it blocks,
+ // it will release mCore->mMutex while blocked so that other operations on
+ // the BufferQueue may succeed.
+ status_t waitForFreeSlotThenRelock(const char* caller, bool async,
+ int* found, status_t* returnFlags) const;
+
sp<BufferQueueCore> mCore;
// This references mCore->mSlots. Lock mCore->mMutex while accessing.