summaryrefslogtreecommitdiffstats
path: root/include/gui/BufferQueueProducer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/gui/BufferQueueProducer.h')
-rw-r--r--include/gui/BufferQueueProducer.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h
index 34c32dc..ed1056a 100644
--- a/include/gui/BufferQueueProducer.h
+++ b/include/gui/BufferQueueProducer.h
@@ -73,7 +73,9 @@ public:
// updateTexImage() is called. If width and height are both zero, the
// default values specified by setDefaultBufferSize() are used instead.
//
- // If the format is 0, the default format will be used.
+ // The pixel formats are enumerated in graphics.h, e.g.
+ // HAL_PIXEL_FORMAT_RGBA_8888. If the format is 0, the default format
+ // will be used.
//
// The usage argument specifies gralloc buffer usage flags. The values
// are enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER. These
@@ -91,9 +93,8 @@ public:
//
// In both cases, the producer will need to call requestBuffer to get a
// GraphicBuffer handle for the returned slot.
- virtual status_t dequeueBuffer(int *outSlot, sp<Fence>* outFence,
- bool async, uint32_t width, uint32_t height, PixelFormat format,
- uint32_t usage);
+ 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);
@@ -170,7 +171,7 @@ public:
// See IGraphicBufferProducer::allocateBuffers
virtual void allocateBuffers(bool async, uint32_t width, uint32_t height,
- PixelFormat format, uint32_t usage);
+ uint32_t format, uint32_t usage);
private:
// This is required by the IBinder::DeathRecipient interface
@@ -196,6 +197,22 @@ private:
uint32_t mStickyTransform;
+ // This saves the fence from the last queueBuffer, such that the
+ // next queueBuffer call can throttle buffer production. The prior
+ // queueBuffer's fence is not nessessarily available elsewhere,
+ // since the previous buffer might have already been acquired.
+ sp<Fence> mLastQueueBufferFence;
+
+ // Take-a-ticket system for ensuring that onFrame* callbacks are called in
+ // the order that frames are queued. While the BufferQueue lock
+ // (mCore->mMutex) is held, a ticket is retained by the producer. After
+ // dropping the BufferQueue lock, the producer must wait on the condition
+ // variable until the current callback ticket matches its retained ticket.
+ Mutex mCallbackMutex;
+ int mNextCallbackTicket; // Protected by mCore->mMutex
+ int mCurrentCallbackTicket; // Protected by mCallbackMutex
+ Condition mCallbackCondition;
+
}; // class BufferQueueProducer
} // namespace android