[Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs
Emil Velikov
emil.l.velikov at gmail.com
Mon Sep 22 17:25:18 PDT 2014
From: Sjoerd Simons <sjoerd.simons at collabora.co.uk>
When using RGBA EGLConfigs allow both RGB and RGBA X visuals, such that
application can decide whether they want to use RGBA (and have the
compositor blend their windows).
On my system with this change EGLConfigs with a 24 bit visual comes up
first, as such applications blindly picking the first EGLConfig will
still get an RGB X visual.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67676
---
Hello gents,
This patch has been stuck in bugzilla since February this year. Bringing
it around here to gather greater exposure and perhaps some
comments/reviews.
-Emil
src/egl/drivers/dri2/egl_dri2.c | 5 +++++
src/egl/drivers/dri2/platform_x11.c | 17 +++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 20a7243..2ed90a7 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -110,6 +110,11 @@ EGLint dri2_to_egl_attribute_map[] = {
static EGLBoolean
dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
{
+
+ if (criteria->NativeVisualID != EGL_DONT_CARE &&
+ conf->NativeVisualID != criteria->NativeVisualID)
+ return EGL_FALSE;
+
if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
return EGL_FALSE;
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index a7a7338..3395fb7 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -672,14 +672,15 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
dri2_add_config(disp, dri2_dpy->driver_configs[j], id++,
surface_type, config_attrs, rgba_masks);
- /* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
- * Otherwise it will only match a 32-bit RGBA visual. On a
- * composited window manager on X11, this will make all of the
- * EGLConfigs with destination alpha get blended by the
- * compositor. This is probably not what the application
- * wants... especially on drivers that only have 32-bit RGBA
- * EGLConfigs! */
- if (d.data->depth == 24) {
+ /* Allow both 24-bit RGB visual and 32 bit RGBA to match a 32-bit
+ * RGBA EGLConfig. Otherwise it will only match a 32-bit RGBA
+ * visual. On a composited window manager on X11, this will make
+ * all of the EGLConfigs with destination alpha get blended by the
+ * compositor. This is probably not what the application wants...
+ * especially on drivers that only have 32-bit RGBA EGLConfigs!
+ * Allowing both allows applications to make the decision whether
+ * 32 bit visuals are intended */
+ if (d.data->depth == 24 || d.data->depth == 32) {
rgba_masks[3] =
~(rgba_masks[0] | rgba_masks[1] | rgba_masks[2]);
dri2_add_config(disp, dri2_dpy->driver_configs[j], id++,
--
2.1.0
More information about the mesa-dev
mailing list