diff options
author | Dan Stoza <stoza@google.com> | 2015-04-24 16:33:38 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-04-24 16:33:38 +0000 |
commit | 6febf6c150b47a8e9ec7d77d988c176fe89ccbf2 (patch) | |
tree | 1e3023f12a9c209ad87a16d94b3793106c6fea15 /include | |
parent | 7536ef4f07a3e8bfe227dbabe2298965af9d9e0e (diff) | |
parent | 5d10894c9d547449cf231f02b736da9dfdebec11 (diff) | |
download | frameworks_native-6febf6c150b47a8e9ec7d77d988c176fe89ccbf2.zip frameworks_native-6febf6c150b47a8e9ec7d77d988c176fe89ccbf2.tar.gz frameworks_native-6febf6c150b47a8e9ec7d77d988c176fe89ccbf2.tar.bz2 |
am 5d10894c: am ef47c080: am 958f5011: Merge "libgui: Allow an IGBProducer to disable allocation"
* commit '5d10894c9d547449cf231f02b736da9dfdebec11':
libgui: Allow an IGBProducer to disable allocation
Diffstat (limited to 'include')
-rw-r--r-- | include/gui/BufferQueueCore.h | 4 | ||||
-rw-r--r-- | include/gui/BufferQueueProducer.h | 3 | ||||
-rw-r--r-- | include/gui/IGraphicBufferProducer.h | 12 | ||||
-rw-r--r-- | include/ui/GraphicBuffer.h | 3 |
4 files changed, 22 insertions, 0 deletions
diff --git a/include/gui/BufferQueueCore.h b/include/gui/BufferQueueCore.h index a6065a9..9a43516 100644 --- a/include/gui/BufferQueueCore.h +++ b/include/gui/BufferQueueCore.h @@ -266,6 +266,10 @@ private: // mIsAllocatingCondition is a condition variable used by producers to wait until mIsAllocating // becomes false. mutable Condition mIsAllocatingCondition; + + // mAllowAllocation determines whether dequeueBuffer is allowed to allocate + // new buffers + bool mAllowAllocation; }; // class BufferQueueCore } // namespace android diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h index f794ea3..ed660fb 100644 --- a/include/gui/BufferQueueProducer.h +++ b/include/gui/BufferQueueProducer.h @@ -172,6 +172,9 @@ public: virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, PixelFormat format, uint32_t usage); + // See IGraphicBufferProducer::allowAllocation + virtual status_t allowAllocation(bool allow); + private: // This is required by the IBinder::DeathRecipient interface virtual void binderDied(const wp<IBinder>& who); diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h index 2d99f24..5c50b2b 100644 --- a/include/gui/IGraphicBufferProducer.h +++ b/include/gui/IGraphicBufferProducer.h @@ -458,6 +458,18 @@ public: // allocated, this function has no effect. virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, PixelFormat format, uint32_t usage) = 0; + + // Sets whether dequeueBuffer is allowed to allocate new buffers. + // + // Normally dequeueBuffer does not discriminate between free slots which + // already have an allocated buffer and those which do not, and will + // allocate a new buffer if the slot doesn't have a buffer or if the slot's + // buffer doesn't match the requested size, format, or usage. This method + // allows the producer to restrict the eligible slots to those which already + // have an allocated buffer of the correct size, format, and usage. If no + // eligible slot is available, dequeueBuffer will block or return an error + // as usual. + virtual status_t allowAllocation(bool allow) = 0; }; // ---------------------------------------------------------------------------- diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h index cea94fc..f91d192 100644 --- a/include/ui/GraphicBuffer.h +++ b/include/ui/GraphicBuffer.h @@ -97,6 +97,9 @@ public: status_t reallocate(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, uint32_t inUsage); + bool needsReallocation(uint32_t inWidth, uint32_t inHeight, + PixelFormat inFormat, uint32_t inUsage); + status_t lock(uint32_t inUsage, void** vaddr); status_t lock(uint32_t inUsage, const Rect& rect, void** vaddr); // For HAL_PIXEL_FORMAT_YCbCr_420_888 |