diff options
author | Chih-Wei Huang <cwhuang@linux.org.tw> | 2015-11-24 01:08:11 +0800 |
---|---|---|
committer | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2016-05-27 01:40:08 +0200 |
commit | 54c95b1a835bca7db58883fb5921481b8945697d (patch) | |
tree | 5d41235c5abd2ff03171299f30370b05326b68ce | |
parent | 770ff1cf7071f1e53d7e52df129bdc3ba2099b17 (diff) | |
download | frameworks_native-54c95b1a835bca7db58883fb5921481b8945697d.zip frameworks_native-54c95b1a835bca7db58883fb5921481b8945697d.tar.gz frameworks_native-54c95b1a835bca7db58883fb5921481b8945697d.tar.bz2 |
libEGL: select pixel format by EGL_NATIVE_VISUAL_ID
We need this workaround until Mesa supports HAL_PIXEL_FORMAT_RGBA_8888.
-rw-r--r-- | opengl/libs/EGL/eglApi.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 4d9eaf5..dc8dc9a 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -462,8 +462,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, // modify the EGLconfig's format before setting the native window's // format. - // by default, just pick RGBA_8888 - EGLint format = HAL_PIXEL_FORMAT_RGBA_8888; + EGLint format; android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN; #if WORKAROUND_BUG_10194508 @@ -478,7 +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 - format = HAL_PIXEL_FORMAT_RGBA_8888; + 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; |