OSDN Git Service

CpuConsumer: Add optional asynchronous mode
authorEino-Ville Talvala <etalvala@google.com>
Thu, 28 Feb 2013 19:01:32 +0000 (11:01 -0800)
committerEino-Ville Talvala <etalvala@google.com>
Thu, 28 Feb 2013 23:51:24 +0000 (15:51 -0800)
Bug: 8290146
Bug: 8291751

Change-Id: I9c8ac4bff38b0411e987a204e540d018dba6d0b4

include/gui/CpuConsumer.h
libs/gui/CpuConsumer.cpp

index a7fdc0a..93dff32 100644 (file)
@@ -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();
 
index 340cd14..1ee6673 100644 (file)
@@ -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);
 }