From c6cd27cbf3ddec77cca97e5bd2b257f80ea99706 Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Wed, 22 Feb 2012 14:37:57 -0800 Subject: [PATCH] libui: add ability to force a framebuffer format for EGL's use This does not actually change the framebuffer format. It merely fakes this format to surfaceflinger so that when it creates framebuffer surfaces it will use this format. It's really a giant HACK to allow interworking with buggy gralloc+GPU driver implementations. You should *NEVER* need to set this for shipping devices. Change-Id: I03eeb5b4d72838ef219df386ecc489fc20ab9cc7 Signed-off-by: Dima Zavin --- libs/ui/Android.mk | 4 ++++ libs/ui/FramebufferNativeWindow.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk index 579c31536..2885d7811 100644 --- a/libs/ui/Android.mk +++ b/libs/ui/Android.mk @@ -32,6 +32,10 @@ LOCAL_SHARED_LIBRARIES := \ libpixelflinger \ libhardware +ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),) +LOCAL_CFLAGS += -DFRAMEBUFFER_FORCE_FORMAT=$(BOARD_FRAMEBUFFER_FORCE_FORMAT) +endif + LOCAL_MODULE:= libui include $(BUILD_SHARED_LIBRARY) diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index d1dca0c90..26d4823db 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -100,6 +100,18 @@ FramebufferNativeWindow::FramebufferNativeWindow() mNumFreeBuffers = NUM_FRAME_BUFFERS; mBufferHead = mNumBuffers-1; + /* + * This does not actually change the framebuffer format. It merely + * fakes this format to surfaceflinger so that when it creates + * framebuffer surfaces it will use this format. It's really a giant + * HACK to allow interworking with buggy gralloc+GPU driver + * implementations. You should *NEVER* need to set this for shipping + * devices. + */ +#ifdef FRAMEBUFFER_FORCE_FORMAT + *((uint32_t *)&fbDev->format) = FRAMEBUFFER_FORCE_FORMAT; +#endif + for (i = 0; i < mNumBuffers; i++) { buffers[i] = new NativeBuffer(