From 1da94dfed674e94edc37cdc8ef68530520edf169 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 27 Feb 2017 18:17:44 -0800 Subject: get rid of IGraphicBufferAlloc buffers can now be allocated in-process. Test: compile & run Bug: cleanup Change-Id: I3d4317a9bed20a6d8be2b7ac8fbb85738efb3657 --- libs/gui/BufferQueueProducer.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'libs/gui/BufferQueueProducer.cpp') diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp index 27ced6180b..b92e895668 100644 --- a/libs/gui/BufferQueueProducer.cpp +++ b/libs/gui/BufferQueueProducer.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -454,8 +453,7 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot, mSlots[found].mBufferState.dequeue(); if ((buffer == NULL) || - buffer->needsReallocation(width, height, format, BQ_LAYER_COUNT, - usage)) + buffer->needsReallocation(width, height, format, BQ_LAYER_COUNT, usage)) { mSlots[found].mAcquireCalled = false; mSlots[found].mGraphicBuffer = NULL; @@ -503,11 +501,13 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot, } // Autolock scope if (returnFlags & BUFFER_NEEDS_REALLOCATION) { - status_t error; BQ_LOGV("dequeueBuffer: allocating a new buffer for slot %d", *outSlot); - sp graphicBuffer(mCore->mAllocator->createGraphicBuffer( - width, height, format, BQ_LAYER_COUNT, usage, - {mConsumerName.string(), mConsumerName.size()}, &error)); + sp graphicBuffer = new GraphicBuffer( + width, height, format, BQ_LAYER_COUNT, usage, usage, + {mConsumerName.string(), mConsumerName.size()}); + + status_t error = graphicBuffer->initCheck(); + { // Autolock scope Mutex::Autolock lock(mCore->mMutex); @@ -1329,11 +1329,12 @@ void BufferQueueProducer::allocateBuffers(uint32_t width, uint32_t height, Vector> buffers; for (size_t i = 0; i < newBufferCount; ++i) { - status_t result = NO_ERROR; - sp graphicBuffer(mCore->mAllocator->createGraphicBuffer( + sp graphicBuffer = new GraphicBuffer( allocWidth, allocHeight, allocFormat, BQ_LAYER_COUNT, - allocUsage, {mConsumerName.string(), mConsumerName.size()}, - &result)); + allocUsage, allocUsage, {mConsumerName.string(), mConsumerName.size()}); + + status_t result = graphicBuffer->initCheck(); + if (result != NO_ERROR) { BQ_LOGE("allocateBuffers: failed to allocate buffer (%u x %u, format" " %u, usage %u)", width, height, format, usage); -- cgit v1.2.3-59-g8ed1b