summaryrefslogtreecommitdiff
path: root/libs/gui/BLASTBufferQueue.cpp
diff options
context:
space:
mode:
author Jim Shargo <jshargo@google.com> 2024-08-13 20:10:54 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-08-13 20:10:54 +0000
commit9d934309cc1dd4eb01b0cda17047f1b18cc8c9ed (patch)
treeac961006e2f63100960edaaf3e2a766661209019 /libs/gui/BLASTBufferQueue.cpp
parent41aeaf82b38b76397b219f76cd1ff28d25379f3d (diff)
parentd30823a16ea4c210d96ac983d2a04bec74b2c35a (diff)
Merge "libgui: ConsumerBase-based classes now create their own BufferQueues" into main
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
-rw-r--r--libs/gui/BLASTBufferQueue.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index 7f0e80e0f0..cda49850f2 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -20,6 +20,7 @@
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
+#include <com_android_graphics_libgui_flags.h>
#include <cutils/atomic.h>
#include <gui/BLASTBufferQueue.h>
#include <gui/BufferItemConsumer.h>
@@ -174,14 +175,21 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, bool updateDestinati
mSyncTransaction(nullptr),
mUpdateDestinationFrame(updateDestinationFrame) {
createBufferQueue(&mProducer, &mConsumer);
- // since the adapter is in the client process, set dequeue timeout
- // explicitly so that dequeueBuffer will block
- mProducer->setDequeueTimeout(std::numeric_limits<int64_t>::max());
-
+#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
+ mBufferItemConsumer = new BLASTBufferItemConsumer(mProducer, mConsumer,
+ GraphicBuffer::USAGE_HW_COMPOSER |
+ GraphicBuffer::USAGE_HW_TEXTURE,
+ 1, false, this);
+#else
mBufferItemConsumer = new BLASTBufferItemConsumer(mConsumer,
GraphicBuffer::USAGE_HW_COMPOSER |
GraphicBuffer::USAGE_HW_TEXTURE,
1, false, this);
+#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_CONSUMER_BASE_OWNS_BQ)
+ // since the adapter is in the client process, set dequeue timeout
+ // explicitly so that dequeueBuffer will block
+ mProducer->setDequeueTimeout(std::numeric_limits<int64_t>::max());
+
static std::atomic<uint32_t> nextId = 0;
mProducerId = nextId++;
mName = name + "#" + std::to_string(mProducerId);