OSDN Git Service

libEGL: select pixel format by EGL_NATIVE_VISUAL_ID
authorChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 4 Sep 2017 11:26:33 +0000 (19:26 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 14 Nov 2019 04:49:34 +0000 (12:49 +0800)
We need this workaround until Mesa supports HAL_PIXEL_FORMAT_RGBA_8888.

opengl/libs/EGL/eglApi.cpp

index c65bddf..f9ce304 100644 (file)
@@ -657,6 +657,9 @@ void getNativePixelFormat(EGLDisplay dpy, egl_connection_t* cnx, EGLConfig confi
         if (componentType == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT) {
             if (colorDepth > 24) {
                 *format = HAL_PIXEL_FORMAT_RGBA_1010102;
+            } else if (cnx->egl.eglGetConfigAttrib(dpy, config, EGL_NATIVE_VISUAL_ID, &colorDepth)) {
+                ALOGE("eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID) failed: %#x", eglGetError());
+                *format = android_pixel_format(colorDepth);
             } else {
                 *format = HAL_PIXEL_FORMAT_RGBA_8888;
             }