vds: Allocate Framebuffer target buffer

Increase frame buffer surface buffers to 3. Call allocateBuffers
from the producer so that buffers are allocated. With out this,
BufferQueue implementation will only allocate 1 buffer

CRs-Fixed: 930504
@Buganizer: 26778657
Change-Id: Id0cadeb78957273d670d63f9956a09454b45eb69
This commit is contained in:
Manoj Kumar AVM 2016-01-13 19:10:20 -08:00 committed by Steve Kondik
parent a9cbaf5097
commit 65a4c0c045

View File

@ -19,6 +19,7 @@
#include "HWComposer.h" #include "HWComposer.h"
#include <gui/BufferItem.h> #include <gui/BufferItem.h>
#include <gui/Surface.h>
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
namespace android { namespace android {
@ -30,6 +31,10 @@ static const bool sForceHwcCopy = true;
static const bool sForceHwcCopy = false; static const bool sForceHwcCopy = false;
#endif #endif
#ifndef NUM_FRAMEBUFFER_SURFACE_BUFFERS
#define NUM_FRAMEBUFFER_SURFACE_BUFFERS (2)
#endif
#define VDS_LOGE(msg, ...) ALOGE("[%s] " msg, \ #define VDS_LOGE(msg, ...) ALOGE("[%s] " msg, \
mDisplayName.string(), ##__VA_ARGS__) mDisplayName.string(), ##__VA_ARGS__)
#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] " msg, \ #define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] " msg, \
@ -64,6 +69,7 @@ VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId,
{ {
mSource[SOURCE_SINK] = sink; mSource[SOURCE_SINK] = sink;
mSource[SOURCE_SCRATCH] = bqProducer; mSource[SOURCE_SCRATCH] = bqProducer;
sp<Surface> surface(new Surface(bqProducer, false));
resetPerFrameState(); resetPerFrameState();
@ -92,7 +98,9 @@ VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId,
mConsumer->setConsumerName(ConsumerBase::mName); mConsumer->setConsumerName(ConsumerBase::mName);
mConsumer->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER); mConsumer->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER);
mConsumer->setDefaultBufferSize(sinkWidth, sinkHeight); mConsumer->setDefaultBufferSize(sinkWidth, sinkHeight);
mConsumer->setDefaultMaxBufferCount(2); mConsumer->setDefaultMaxBufferCount(NUM_FRAMEBUFFER_SURFACE_BUFFERS);
surface->allocateBuffers();
} }
VirtualDisplaySurface::~VirtualDisplaySurface() { VirtualDisplaySurface::~VirtualDisplaySurface() {