[Mesa-dev] [PATCH 12/22] egl/x11: Handle depth 30 drawables for EGL_KHR_image_pixmap.
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 ARGB or ARGB2101010, therefore an assignment of __DRI_IMAGE_FORMAT_ARGB 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 ARGB 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 Signed-off-by: Mario Kleiner Reviewed-by: Tapani Pälli Reviewed-by: Marek Olšák --- src/egl/drivers/dri2/platform_x11.c | 3 +++ src/egl/drivers/dri2/platform_x11_dri3.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 4750872..8b701d5 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1049,6 +1049,9 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, case 24: format = __DRI_IMAGE_FORMAT_XRGB; break; + case 30: + format = __DRI_IMAGE_FORMAT_XRGB2101010; + break; case 32: format = __DRI_IMAGE_FORMAT_ARGB; break; diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index eadd371..6e40eaa 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -269,6 +269,9 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, case 24: format = __DRI_IMAGE_FORMAT_XRGB; break; + case 30: + format = __DRI_IMAGE_FORMAT_XRGB2101010; + break; case 32: format = __DRI_IMAGE_FORMAT_ARGB; break; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 12/22] egl/x11: Handle depth 30 drawables for EGL_KHR_image_pixmap.
Patches 9,10,11,12 LGTM Reviewed-by: Tapani Pälli On 29.11.2017 06:20, Mario Kleiner wrote: 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 ARGB or ARGB2101010, therefore an assignment of __DRI_IMAGE_FORMAT_ARGB 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 ARGB 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 Signed-off-by: Mario Kleiner --- src/egl/drivers/dri2/platform_x11.c | 3 +++ src/egl/drivers/dri2/platform_x11_dri3.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 8e48376..61c842d 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1050,6 +1050,9 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, case 24: format = __DRI_IMAGE_FORMAT_XRGB; break; + case 30: + format = __DRI_IMAGE_FORMAT_XRGB2101010; + break; case 32: format = __DRI_IMAGE_FORMAT_ARGB; break; diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index eadd371..6e40eaa 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -269,6 +269,9 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, case 24: format = __DRI_IMAGE_FORMAT_XRGB; break; + case 30: + format = __DRI_IMAGE_FORMAT_XRGB2101010; + break; case 32: format = __DRI_IMAGE_FORMAT_ARGB; break; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/22] egl/x11: Handle depth 30 drawables for EGL_KHR_image_pixmap.
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 ARGB or ARGB2101010, therefore an assignment of __DRI_IMAGE_FORMAT_ARGB 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 ARGB 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 Signed-off-by: Mario Kleiner --- src/egl/drivers/dri2/platform_x11.c | 3 +++ src/egl/drivers/dri2/platform_x11_dri3.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 8e48376..61c842d 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1050,6 +1050,9 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, case 24: format = __DRI_IMAGE_FORMAT_XRGB; break; + case 30: + format = __DRI_IMAGE_FORMAT_XRGB2101010; + break; case 32: format = __DRI_IMAGE_FORMAT_ARGB; break; diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index eadd371..6e40eaa 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -269,6 +269,9 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx, case 24: format = __DRI_IMAGE_FORMAT_XRGB; break; + case 30: + format = __DRI_IMAGE_FORMAT_XRGB2101010; + break; case 32: format = __DRI_IMAGE_FORMAT_ARGB; break; -- 2.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev