diff --git a/include/media/openmax/OMX_IVCommon.h b/include/media/openmax/OMX_IVCommon.h index 8bb4dede8..effbaaebe 100644 --- a/include/media/openmax/OMX_IVCommon.h +++ b/include/media/openmax/OMX_IVCommon.h @@ -159,6 +159,7 @@ typedef enum OMX_COLOR_FORMATTYPE { OMX_COLOR_FormatAndroidOpaque = 0x7F000789, OMX_TI_COLOR_FormatYUV420PackedSemiPlanar = 0x7F000100, OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00, + OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7FA30C03, OMX_COLOR_FormatMax = 0x7FFFFFFF } OMX_COLOR_FORMATTYPE; diff --git a/include/ui/FramebufferNativeWindow.h b/include/ui/FramebufferNativeWindow.h index e0b14f738..5ec738f33 100644 --- a/include/ui/FramebufferNativeWindow.h +++ b/include/ui/FramebufferNativeWindow.h @@ -28,7 +28,8 @@ #include #include -#define NUM_FRAME_BUFFERS 2 +#define MIN_NUM_FRAME_BUFFERS 2 +#define MAX_NUM_FRAME_BUFFERS 3 extern "C" EGLNativeWindowType android_createDisplaySurface(void); @@ -77,7 +78,7 @@ private: framebuffer_device_t* fbDev; alloc_device_t* grDev; - sp buffers[NUM_FRAME_BUFFERS]; + sp buffers[MAX_NUM_FRAME_BUFFERS]; sp front; mutable Mutex mutex; diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index 5a36c3bb2..31a69b211 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -93,8 +93,13 @@ FramebufferNativeWindow::FramebufferNativeWindow() mUpdateOnDemand = (fbDev->setUpdateRect != 0); // initialize the buffer FIFO - mNumBuffers = NUM_FRAME_BUFFERS; - mNumFreeBuffers = NUM_FRAME_BUFFERS; + if(fbDev->numFramebuffers >= MIN_NUM_FRAME_BUFFERS && + fbDev->numFramebuffers <= MAX_NUM_FRAME_BUFFERS){ + mNumBuffers = fbDev->numFramebuffers; + } else { + mNumBuffers = MIN_NUM_FRAME_BUFFERS; + } + mNumFreeBuffers = mNumBuffers; mBufferHead = mNumBuffers-1; /* @@ -158,10 +163,11 @@ FramebufferNativeWindow::FramebufferNativeWindow() FramebufferNativeWindow::~FramebufferNativeWindow() { if (grDev) { - if (buffers[0] != NULL) - grDev->free(grDev, buffers[0]->handle); - if (buffers[1] != NULL) - grDev->free(grDev, buffers[1]->handle); + for(int i = 0; i < mNumBuffers; i++) { + if (buffers[i] != NULL) { + grDev->free(grDev, buffers[i]->handle); + } + } gralloc_close(grDev); }