surfaceflinger: Add support for Exynos BGRA mixer

Change-Id: Ibc9f784b35a7bd6d8cc6b13ff68b12418cce98c5
This commit is contained in:
Christopher N. Hesse 2016-04-24 19:30:35 +02:00 committed by Ethan Chen
parent ec0faee33a
commit 3ce4ffc46e
4 changed files with 33 additions and 0 deletions

View File

@ -65,6 +65,10 @@ ifneq ($(MAX_EGL_CACHE_SIZE),)
LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE) LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE)
endif endif
ifeq ($(BOARD_USE_BGRA_8888), true)
LOCAL_CFLAGS += -DUSE_BGRA_8888
endif
LOCAL_REQUIRED_MODULES := $(egl.cfg_config_module) LOCAL_REQUIRED_MODULES := $(egl.cfg_config_module)
egl.cfg_config_module := egl.cfg_config_module :=

View File

@ -462,8 +462,13 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
// modify the EGLconfig's format before setting the native window's // modify the EGLconfig's format before setting the native window's
// format. // format.
#ifdef USE_BGRA_8888
// by default, just pick BGRA_8888
EGLint format = HAL_PIXEL_FORMAT_BGRA_8888;
#else
// by default, just pick RGBA_8888 // by default, just pick RGBA_8888
EGLint format = HAL_PIXEL_FORMAT_RGBA_8888; EGLint format = HAL_PIXEL_FORMAT_RGBA_8888;
#endif
android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN; android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN;
#if WORKAROUND_BUG_10194508 #if WORKAROUND_BUG_10194508
@ -478,7 +483,11 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_ALPHA_SIZE, &a); cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_ALPHA_SIZE, &a);
if (a > 0) { if (a > 0) {
// alpha-channel requested, there's really only one suitable format // alpha-channel requested, there's really only one suitable format
#ifdef USE_BGRA_8888
format = HAL_PIXEL_FORMAT_BGRA_8888;
#else
format = HAL_PIXEL_FORMAT_RGBA_8888; format = HAL_PIXEL_FORMAT_RGBA_8888;
#endif
} else { } else {
EGLint r, g, b; EGLint r, g, b;
r = g = b = 0; r = g = b = 0;

View File

@ -95,6 +95,10 @@ else
LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=0 LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=0
endif endif
ifeq ($(BOARD_USE_BGRA_8888),true)
LOCAL_CFLAGS += -DUSE_BGRA_8888
endif
LOCAL_CFLAGS += -fvisibility=hidden -Werror=format LOCAL_CFLAGS += -fvisibility=hidden -Werror=format
LOCAL_CFLAGS += -std=c++11 LOCAL_CFLAGS += -std=c++11

View File

@ -435,7 +435,11 @@ status_t HWComposer::queryDisplayProperties(int disp) {
} }
// FIXME: what should we set the format to? // FIXME: what should we set the format to?
#ifdef USE_BGRA_8888
mDisplayData[disp].format = HAL_PIXEL_FORMAT_BGRA_8888;
#else
mDisplayData[disp].format = HAL_PIXEL_FORMAT_RGBA_8888; mDisplayData[disp].format = HAL_PIXEL_FORMAT_RGBA_8888;
#endif
mDisplayData[disp].connected = true; mDisplayData[disp].connected = true;
return NO_ERROR; return NO_ERROR;
} }
@ -497,7 +501,11 @@ sp<Fence> HWComposer::getDisplayFence(int disp) const {
uint32_t HWComposer::getFormat(int disp) const { uint32_t HWComposer::getFormat(int disp) const {
if (static_cast<uint32_t>(disp) >= MAX_HWC_DISPLAYS || !mAllocatedDisplayIDs.hasBit(disp)) { if (static_cast<uint32_t>(disp) >= MAX_HWC_DISPLAYS || !mAllocatedDisplayIDs.hasBit(disp)) {
#ifdef USE_BGRA_8888
return HAL_PIXEL_FORMAT_BGRA_8888;
#else
return HAL_PIXEL_FORMAT_RGBA_8888; return HAL_PIXEL_FORMAT_RGBA_8888;
#endif
} else { } else {
return mDisplayData[disp].format; return mDisplayData[disp].format;
} }
@ -879,7 +887,11 @@ int HWComposer::getVisualID() const {
// FIXME: temporary hack until HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED // FIXME: temporary hack until HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED
// is supported by the implementation. we can only be in this case // is supported by the implementation. we can only be in this case
// if we have HWC 1.1 // if we have HWC 1.1
#ifdef USE_BGRA_8888
return HAL_PIXEL_FORMAT_BGRA_8888;
#else
return HAL_PIXEL_FORMAT_RGBA_8888; return HAL_PIXEL_FORMAT_RGBA_8888;
#endif
//return HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED; //return HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
} else { } else {
return mFbDev->format; return mFbDev->format;
@ -1367,7 +1379,11 @@ bool HWComposer::VSyncThread::threadLoop() {
HWComposer::DisplayData::DisplayData() HWComposer::DisplayData::DisplayData()
: configs(), : configs(),
currentConfig(0), currentConfig(0),
#ifdef USE_BGRA_8888
format(HAL_PIXEL_FORMAT_BGRA_8888),
#else
format(HAL_PIXEL_FORMAT_RGBA_8888), format(HAL_PIXEL_FORMAT_RGBA_8888),
#endif
connected(false), connected(false),
hasFbComp(false), hasOvComp(false), hasFbComp(false), hasOvComp(false),
capacity(0), list(NULL), capacity(0), list(NULL),