Loading include/gui/BufferQueue.h +2 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,8 @@ public: // needed gralloc buffers. static void createBufferQueue(sp<IGraphicBufferProducer>* outProducer, sp<IGraphicBufferConsumer>* outConsumer, const sp<IGraphicBufferAlloc>& allocator = NULL); const sp<IGraphicBufferAlloc>& allocator = NULL, bool consumerIsSurfaceFlinger = false); private: BufferQueue(); // Create through createBufferQueue Loading include/gui/BufferQueueProducer.h +5 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class BufferQueueProducer : public BnGraphicBufferProducer, public: friend class BufferQueue; // Needed to access binderDied BufferQueueProducer(const sp<BufferQueueCore>& core); BufferQueueProducer(const sp<BufferQueueCore>& core, bool consumerIsSurfaceFlinger = false); virtual ~BufferQueueProducer(); // requestBuffer returns the GraphicBuffer for slot N. Loading Loading @@ -225,6 +225,10 @@ private: uint32_t mStickyTransform; // This controls whether the GraphicBuffer pointer in the BufferItem is // cleared after being queued bool mConsumerIsSurfaceFlinger; // 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, Loading include/gui/IConsumerListener.h +2 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,8 @@ public: // previous frames are pending. Frames queued while in synchronous mode // always trigger the callback. The item passed to the callback will contain // all of the information about the queued frame except for its // GraphicBuffer pointer, which will always be null. // GraphicBuffer pointer, which will always be null (except if the consumer // is SurfaceFlinger). // // This is called without any lock held and can be called concurrently // by multiple threads. Loading libs/gui/BufferQueue.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ bool BufferQueue::ProxyConsumerListener::getFrameTimestamps( void BufferQueue::createBufferQueue(sp<IGraphicBufferProducer>* outProducer, sp<IGraphicBufferConsumer>* outConsumer, const sp<IGraphicBufferAlloc>& allocator) { const sp<IGraphicBufferAlloc>& allocator, bool consumerIsSurfaceFlinger) { LOG_ALWAYS_FATAL_IF(outProducer == NULL, "BufferQueue: outProducer must not be NULL"); LOG_ALWAYS_FATAL_IF(outConsumer == NULL, Loading @@ -82,7 +83,7 @@ void BufferQueue::createBufferQueue(sp<IGraphicBufferProducer>* outProducer, LOG_ALWAYS_FATAL_IF(core == NULL, "BufferQueue: failed to create BufferQueueCore"); sp<IGraphicBufferProducer> producer(new BufferQueueProducer(core)); sp<IGraphicBufferProducer> producer(new BufferQueueProducer(core, consumerIsSurfaceFlinger)); LOG_ALWAYS_FATAL_IF(producer == NULL, "BufferQueue: failed to create BufferQueueProducer"); Loading libs/gui/BufferQueueProducer.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -41,11 +41,13 @@ namespace android { BufferQueueProducer::BufferQueueProducer(const sp<BufferQueueCore>& core) : BufferQueueProducer::BufferQueueProducer(const sp<BufferQueueCore>& core, bool consumerIsSurfaceFlinger) : mCore(core), mSlots(core->mSlots), mConsumerName(), mStickyTransform(0), mConsumerIsSurfaceFlinger(consumerIsSurfaceFlinger), mLastQueueBufferFence(Fence::NO_FENCE), mLastQueuedTransform(0), mCallbackMutex(), Loading Loading @@ -913,9 +915,14 @@ status_t BufferQueueProducer::queueBuffer(int slot, VALIDATE_CONSISTENCY(); } // Autolock scope // Don't send the GraphicBuffer through the callback, and don't send // the slot number, since the consumer shouldn't need it // It is okay not to clear the GraphicBuffer when the consumer is SurfaceFlinger because // it is guaranteed that the BufferQueue is inside SurfaceFlinger's process and // there will be no Binder call if (!mConsumerIsSurfaceFlinger) { item.mGraphicBuffer.clear(); } // Don't send the slot number through the callback since the consumer shouldn't need it item.mSlot = BufferItem::INVALID_BUFFER_SLOT; // Call back without the main BufferQueue lock held, but with the callback Loading Loading
include/gui/BufferQueue.h +2 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,8 @@ public: // needed gralloc buffers. static void createBufferQueue(sp<IGraphicBufferProducer>* outProducer, sp<IGraphicBufferConsumer>* outConsumer, const sp<IGraphicBufferAlloc>& allocator = NULL); const sp<IGraphicBufferAlloc>& allocator = NULL, bool consumerIsSurfaceFlinger = false); private: BufferQueue(); // Create through createBufferQueue Loading
include/gui/BufferQueueProducer.h +5 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class BufferQueueProducer : public BnGraphicBufferProducer, public: friend class BufferQueue; // Needed to access binderDied BufferQueueProducer(const sp<BufferQueueCore>& core); BufferQueueProducer(const sp<BufferQueueCore>& core, bool consumerIsSurfaceFlinger = false); virtual ~BufferQueueProducer(); // requestBuffer returns the GraphicBuffer for slot N. Loading Loading @@ -225,6 +225,10 @@ private: uint32_t mStickyTransform; // This controls whether the GraphicBuffer pointer in the BufferItem is // cleared after being queued bool mConsumerIsSurfaceFlinger; // 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, Loading
include/gui/IConsumerListener.h +2 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,8 @@ public: // previous frames are pending. Frames queued while in synchronous mode // always trigger the callback. The item passed to the callback will contain // all of the information about the queued frame except for its // GraphicBuffer pointer, which will always be null. // GraphicBuffer pointer, which will always be null (except if the consumer // is SurfaceFlinger). // // This is called without any lock held and can be called concurrently // by multiple threads. Loading
libs/gui/BufferQueue.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -72,7 +72,8 @@ bool BufferQueue::ProxyConsumerListener::getFrameTimestamps( void BufferQueue::createBufferQueue(sp<IGraphicBufferProducer>* outProducer, sp<IGraphicBufferConsumer>* outConsumer, const sp<IGraphicBufferAlloc>& allocator) { const sp<IGraphicBufferAlloc>& allocator, bool consumerIsSurfaceFlinger) { LOG_ALWAYS_FATAL_IF(outProducer == NULL, "BufferQueue: outProducer must not be NULL"); LOG_ALWAYS_FATAL_IF(outConsumer == NULL, Loading @@ -82,7 +83,7 @@ void BufferQueue::createBufferQueue(sp<IGraphicBufferProducer>* outProducer, LOG_ALWAYS_FATAL_IF(core == NULL, "BufferQueue: failed to create BufferQueueCore"); sp<IGraphicBufferProducer> producer(new BufferQueueProducer(core)); sp<IGraphicBufferProducer> producer(new BufferQueueProducer(core, consumerIsSurfaceFlinger)); LOG_ALWAYS_FATAL_IF(producer == NULL, "BufferQueue: failed to create BufferQueueProducer"); Loading
libs/gui/BufferQueueProducer.cpp +11 −4 Original line number Diff line number Diff line Loading @@ -41,11 +41,13 @@ namespace android { BufferQueueProducer::BufferQueueProducer(const sp<BufferQueueCore>& core) : BufferQueueProducer::BufferQueueProducer(const sp<BufferQueueCore>& core, bool consumerIsSurfaceFlinger) : mCore(core), mSlots(core->mSlots), mConsumerName(), mStickyTransform(0), mConsumerIsSurfaceFlinger(consumerIsSurfaceFlinger), mLastQueueBufferFence(Fence::NO_FENCE), mLastQueuedTransform(0), mCallbackMutex(), Loading Loading @@ -913,9 +915,14 @@ status_t BufferQueueProducer::queueBuffer(int slot, VALIDATE_CONSISTENCY(); } // Autolock scope // Don't send the GraphicBuffer through the callback, and don't send // the slot number, since the consumer shouldn't need it // It is okay not to clear the GraphicBuffer when the consumer is SurfaceFlinger because // it is guaranteed that the BufferQueue is inside SurfaceFlinger's process and // there will be no Binder call if (!mConsumerIsSurfaceFlinger) { item.mGraphicBuffer.clear(); } // Don't send the slot number through the callback since the consumer shouldn't need it item.mSlot = BufferItem::INVALID_BUFFER_SLOT; // Call back without the main BufferQueue lock held, but with the callback Loading