From 2e614a493cbfbc34430993ee158378fba235a3b2 Mon Sep 17 00:00:00 2001 From: Jim Shargo Date: Wed, 2 Oct 2024 19:31:53 +0000 Subject: 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 --- libs/gui/ConsumerBase.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libs/gui/ConsumerBase.cpp') diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp index 602bba8dab..e772f44a4f 100644 --- a/libs/gui/ConsumerBase.cpp +++ b/libs/gui/ConsumerBase.cpp @@ -254,6 +254,17 @@ void ConsumerBase::onBuffersReleased() { void ConsumerBase::onSidebandStreamChanged() { } +#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_UNLIMITED_SLOTS) +void ConsumerBase::onSlotCountChanged(int slotCount) { + CB_LOGV("onSlotCountChanged: %d", slotCount); + Mutex::Autolock lock(mMutex); + + if (slotCount > (int)mSlots.size()) { + mSlots.resize(slotCount); + } +} +#endif + void ConsumerBase::abandon() { CB_LOGV("abandon"); Mutex::Autolock lock(mMutex); -- cgit v1.2.3-59-g8ed1b