From cdbaecb54152ce98789823420d426077d72aa1e7 Mon Sep 17 00:00:00 2001 From: Jamie Gennis Date: Fri, 12 Oct 2012 14:18:10 -0700 Subject: [PATCH] SurfaceFlinger: make the num FBs a board config Bug: 7283132 Change-Id: I38116f39fc18212f2daab94bbfc3daaf89439fc4 --- services/surfaceflinger/Android.mk | 4 ++++ .../surfaceflinger/DisplayHardware/FramebufferSurface.cpp | 6 +++++- .../surfaceflinger/DisplayHardware/FramebufferSurface.h | 2 -- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index 0d559e778..5a5769795 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -38,6 +38,10 @@ ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true) LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING endif +ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),) + LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS) +endif + LOCAL_SHARED_LIBRARIES := \ libcutils \ libdl \ diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp index 9ada19712..6c86a53a3 100644 --- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp +++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp @@ -36,6 +36,10 @@ #include "DisplayHardware/GraphicBufferAlloc.h" #include "DisplayHardware/HWComposer.h" +#ifndef NUM_FRAMEBUFFER_SURFACE_BUFFERS +#define NUM_FRAMEBUFFER_SURFACE_BUFFERS (2) +#endif + // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- @@ -61,7 +65,7 @@ FramebufferSurface::FramebufferSurface(HWComposer& hwc, int disp) : mBufferQueue->setDefaultBufferFormat(mHwc.getFormat(disp)); mBufferQueue->setDefaultBufferSize(mHwc.getWidth(disp), mHwc.getHeight(disp)); mBufferQueue->setSynchronousMode(true); - mBufferQueue->setDefaultMaxBufferCount(NUM_FRAME_BUFFERS); + mBufferQueue->setDefaultMaxBufferCount(NUM_FRAMEBUFFER_SURFACE_BUFFERS); } status_t FramebufferSurface::nextBuffer(sp& outBuffer, sp& outFence) { diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h index d64fea78b..633634522 100644 --- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h +++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h @@ -22,8 +22,6 @@ #include -#define NUM_FRAME_BUFFERS 2 - // --------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------