diff options
author | 2024-10-02 19:31:53 +0000 | |
---|---|---|
committer | 2024-12-12 23:35:54 +0000 | |
commit | 2e614a493cbfbc34430993ee158378fba235a3b2 (patch) | |
tree | 570b42003e2a86a156ee1907b673dd91cf4d8374 /libs/gui/IGraphicBufferConsumer.cpp | |
parent | 8c6afcf151af438342729f2399c43560ae1f353c (diff) |
libgui: Add support for unlimited slot BufferQueues
BufferQueues can now be of unlimited size, according to the wishes of
the producer.
We add four new methods:
- IGBC::allowUnlimitedSlots, which permits the IGBP to call
extendSlotCount
- IGBP::extendSlotCount, which increases the total available slot count
to a fixed number and notifies the consumer via
ICL::onSlotCountChanged
- ICL::onSlotCountChanged, which notifies the consumer to resize its
personal slot vector
- IGBC::getReleasedBuffersExtented, which is like getReleasedBuffers but
with an arbitrary sized bitvector instead of a fixed 64 bit vector
The internal representation of the slots in BufferQueueCore is now a
vector instead of an array, and can grow (but not shrink). The only
consumers of these new APIs are intented to be Surface and ConsumerBase.
Everything else is being migrated away from IGBP/IGBC anyway.
This is part of go/warren-buffers.
Bug: 341359814
Flag: com.android.graphics.libgui.flags.wb_unlimited_slots
Test: new tests, old tests
Change-Id: I0df872b9d6f9273854cc07a88d29b65451e1832a
Diffstat (limited to 'libs/gui/IGraphicBufferConsumer.cpp')
-rw-r--r-- | libs/gui/IGraphicBufferConsumer.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/libs/gui/IGraphicBufferConsumer.cpp b/libs/gui/IGraphicBufferConsumer.cpp index 282957b940..c1b65689d6 100644 --- a/libs/gui/IGraphicBufferConsumer.cpp +++ b/libs/gui/IGraphicBufferConsumer.cpp @@ -16,6 +16,7 @@ #include <gui/IGraphicBufferConsumer.h> +#include <com_android_graphics_libgui_flags.h> #include <gui/BufferItem.h> #include <gui/IConsumerListener.h> @@ -24,6 +25,7 @@ #include <ui/Fence.h> #include <ui/GraphicBuffer.h> +#include <utils/Errors.h> #include <utils/NativeHandle.h> #include <utils/String8.h> #include <cstdint> @@ -53,7 +55,9 @@ enum class Tag : uint32_t { GET_OCCUPANCY_HISTORY, DISCARD_FREE_BUFFERS, DUMP_STATE, - LAST = DUMP_STATE, + ALLOW_UNLIMITED_SLOTS, + GET_RELEASED_BUFFERS_EXTENDED, + LAST = GET_RELEASED_BUFFERS_EXTENDED, }; } // Anonymous namespace @@ -104,11 +108,25 @@ public: return callRemote<Signature>(Tag::GET_RELEASED_BUFFERS, slotMask); } +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_UNLIMITED_SLOTS) + status_t getReleasedBuffersExtended(std::vector<bool>* slotMask) override { + using Signature = decltype(&IGraphicBufferConsumer::getReleasedBuffersExtended); + return callRemote<Signature>(Tag::GET_RELEASED_BUFFERS_EXTENDED, slotMask); + } +#endif + status_t setDefaultBufferSize(uint32_t width, uint32_t height) override { using Signature = decltype(&IGraphicBufferConsumer::setDefaultBufferSize); return callRemote<Signature>(Tag::SET_DEFAULT_BUFFER_SIZE, width, height); } +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_UNLIMITED_SLOTS) + status_t allowUnlimitedSlots(bool allowUnlimitedSlots) override { + using Signature = decltype(&IGraphicBufferConsumer::allowUnlimitedSlots); + return callRemote<Signature>(Tag::ALLOW_UNLIMITED_SLOTS, allowUnlimitedSlots); + } +#endif + status_t setMaxBufferCount(int bufferCount) override { using Signature = decltype(&IGraphicBufferConsumer::setMaxBufferCount); return callRemote<Signature>(Tag::SET_MAX_BUFFER_COUNT, bufferCount); @@ -228,6 +246,20 @@ status_t BnGraphicBufferConsumer::onTransact(uint32_t code, const Parcel& data, using Signature = status_t (IGraphicBufferConsumer::*)(const String8&, String8*) const; return callLocal<Signature>(data, reply, &IGraphicBufferConsumer::dumpState); } + case Tag::GET_RELEASED_BUFFERS_EXTENDED: { +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_UNLIMITED_SLOTS) + return callLocal(data, reply, &IGraphicBufferConsumer::getReleasedBuffersExtended); +#else + return INVALID_OPERATION; +#endif + } + case Tag::ALLOW_UNLIMITED_SLOTS: { +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_UNLIMITED_SLOTS) + return callLocal(data, reply, &IGraphicBufferConsumer::allowUnlimitedSlots); +#else + return INVALID_OPERATION; +#endif + } } } |