From eb0d12963d271052c24abb025d698504df9e7573 Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Thu, 28 Feb 2013 11:01:32 -0800 Subject: [PATCH] CpuConsumer: Add optional asynchronous mode Bug: 8290146 Bug: 8291751 Change-Id: I9c8ac4bff38b0411e987a204e540d018dba6d0b4 --- include/gui/CpuConsumer.h | 2 +- libs/gui/CpuConsumer.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gui/CpuConsumer.h b/include/gui/CpuConsumer.h index a7fdc0a9a..93dff32bf 100644 --- a/include/gui/CpuConsumer.h +++ b/include/gui/CpuConsumer.h @@ -57,7 +57,7 @@ class CpuConsumer: public ConsumerBase // Create a new CPU consumer. The maxLockedBuffers parameter specifies // how many buffers can be locked for user access at the same time. - CpuConsumer(uint32_t maxLockedBuffers); + CpuConsumer(uint32_t maxLockedBuffers, bool synchronousMode = true); virtual ~CpuConsumer(); diff --git a/libs/gui/CpuConsumer.cpp b/libs/gui/CpuConsumer.cpp index 340cd14d8..1ee667355 100644 --- a/libs/gui/CpuConsumer.cpp +++ b/libs/gui/CpuConsumer.cpp @@ -29,7 +29,7 @@ namespace android { -CpuConsumer::CpuConsumer(uint32_t maxLockedBuffers) : +CpuConsumer::CpuConsumer(uint32_t maxLockedBuffers, bool synchronousMode) : ConsumerBase(new BufferQueue(true) ), mMaxLockedBuffers(maxLockedBuffers), mCurrentLockedBuffers(0) @@ -38,7 +38,7 @@ CpuConsumer::CpuConsumer(uint32_t maxLockedBuffers) : mLockedSlots[i].mBufferPointer = NULL; } - mBufferQueue->setSynchronousMode(true); + mBufferQueue->setSynchronousMode(synchronousMode); mBufferQueue->setConsumerUsageBits(GRALLOC_USAGE_SW_READ_OFTEN); mBufferQueue->setMaxAcquiredBufferCount(maxLockedBuffers); }