gui: Remove BufferQueue::MIN_UNDEQUEUED_BUFFERS

Change-Id: I7c0cc36046dbbdb9c0e85acfe5027293d1131275
This commit is contained in:
Igor Murashkin 2013-11-18 12:26:56 -08:00
parent 7d2d160cdc
commit 4be18a3566
3 changed files with 9 additions and 2 deletions

View File

@ -44,6 +44,7 @@ class BufferItemConsumer: public ConsumerBase
typedef BufferQueue::BufferItem BufferItem;
enum { MIN_UNDEQUEUED_BUFFERS = -1 };
enum { INVALID_BUFFER_SLOT = BufferQueue::INVALID_BUFFER_SLOT };
enum { NO_BUFFER_AVAILABLE = BufferQueue::NO_BUFFER_AVAILABLE };
@ -54,7 +55,7 @@ class BufferItemConsumer: public ConsumerBase
// controlledByApp tells whether this consumer is controlled by the
// application.
BufferItemConsumer(const sp<BufferQueue>& bq, uint32_t consumerUsage,
int bufferCount = BufferQueue::MIN_UNDEQUEUED_BUFFERS,
int bufferCount = MIN_UNDEQUEUED_BUFFERS,
bool controlledByApp = false);
virtual ~BufferItemConsumer();

View File

@ -41,7 +41,6 @@ class BufferQueue : public BnGraphicBufferProducer,
public BnGraphicBufferConsumer,
private IBinder::DeathRecipient {
public:
enum { MIN_UNDEQUEUED_BUFFERS = 2 };
// BufferQueue will keep track of at most this value of buffers.
// Attempts at runtime to increase the number of buffers past this will fail.
enum { NUM_BUFFER_SLOTS = 32 };

View File

@ -33,6 +33,13 @@ BufferItemConsumer::BufferItemConsumer(const sp<BufferQueue>& bq,
uint32_t consumerUsage, int bufferCount, bool controlledByApp) :
ConsumerBase(bq, controlledByApp)
{
if (bufferCount == MIN_UNDEQUEUED_BUFFERS) {
status_t res;
res = bq->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &bufferCount);
LOG_ALWAYS_FATAL_IF(res != OK || bufferCount < 0,
"Failed to query min buffer count");
}
mConsumer->setConsumerUsageBits(consumerUsage);
mConsumer->setMaxAcquiredBufferCount(bufferCount);
}