egl/x11: Handle depth 30 drawables for EGL_KHR_image_pixmap.
authorMario Kleiner <mario.kleiner.de@gmail.com>
Fri, 15 Dec 2017 22:04:59 +0000 (23:04 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 3 Jan 2018 21:57:56 +0000 (22:57 +0100)
Enables eglCreateImageKHR() with target set to
EGL_NATIVE_PIXMAP_KHR to handle color depth 30
X11 drawables.

Note that in theory the drawable depth 32 case in the
current implementation is ambiguous: A depth 32 drawable
could be of format ARGB8888 or ARGB2101010, therefore an
assignment of __DRI_IMAGE_FORMAT_ARGB8888 for a pixmap of
ARGB2101010 format would be wrong. In practice however, the
X-Server (as of v1.19) does not provide any depth 32 visuals
for ARGB2101010 EGL/GLX configs. Those are associated with
depth 30 visuals without an alpha channel instead. Therefore
the switch-case depth 32 branch is only executed for ARGB8888
pixmaps and we get away with this.

Tested with KDE Plasma 5 under X11, DRI2 and DRI3/Present,
selecting EGL + OpenGL compositing and different fbconfigs
with/without 2 bit alpha channel. glxinfo confirms use of
depth 30 visuals for ARGB2101010 only.

Suggested-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/egl/drivers/dri2/platform_x11.c
src/egl/drivers/dri2/platform_x11_dri3.c

index 3c09a4fb0b0af21f1be577f53c9ce6004e8f236d..6c287b4d06b35b94c8537f528dfaa6ff993c8b22 100644 (file)
@@ -1049,6 +1049,9 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
    case 24:
       format = __DRI_IMAGE_FORMAT_XRGB8888;
       break;
+   case 30:
+      format = __DRI_IMAGE_FORMAT_XRGB2101010;
+      break;
    case 32:
       format = __DRI_IMAGE_FORMAT_ARGB8888;
       break;
index eadd37141e08307e5cd7823a4f80c2a50d66f055..6e40eaa596ad05a79dfe4d8bd818be33ee8ec5cb 100644 (file)
@@ -269,6 +269,9 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
    case 24:
       format = __DRI_IMAGE_FORMAT_XRGB8888;
       break;
+   case 30:
+      format = __DRI_IMAGE_FORMAT_XRGB2101010;
+      break;
    case 32:
       format = __DRI_IMAGE_FORMAT_ARGB8888;
       break;