diff options
Diffstat (limited to 'opengl/libs/EGL/eglApi.cpp')
-rw-r--r-- | opengl/libs/EGL/eglApi.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 2f6bc79..dc8dc9a 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -462,13 +462,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, // modify the EGLconfig's format before setting the native window's // 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 - EGLint format = HAL_PIXEL_FORMAT_RGBA_8888; -#endif + EGLint format; android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN; #if WORKAROUND_BUG_10194508 @@ -483,11 +477,12 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_ALPHA_SIZE, &a); if (a > 0) { // 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; -#endif + if (!cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_NATIVE_VISUAL_ID, + &format)) { + ALOGE("eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID) failed: %#x", + eglGetError()); + format = HAL_PIXEL_FORMAT_RGBA_8888; + } } else { EGLint r, g, b; r = g = b = 0; |