egl/x11: Move RGBA visuals in the second config selection group

This ensures that alpha-blended windows are at the bottom of the visuals
list, so they don't get picked up accidentally.

Based on: "egl-X11: Put RGBA visuals in the second config selection group"

Suggested-by: Freya Gentz <zegentzy@protonmail.com>  # original concept
Co-authored-by: Robert Mader <robert.mader@posteo.de>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9989>
This commit is contained in:
David Heidelberg 2024-03-24 02:33:00 +01:00 committed by Marge Bot
parent 0d90415625
commit 3736c9997c

View file

@ -821,6 +821,16 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
EGL_NONE,
};
const EGLint config_attrs_2nd_group[] = {
EGL_NATIVE_VISUAL_ID,
visuals[i].visual_id,
EGL_NATIVE_VISUAL_TYPE,
visuals[i]._class,
EGL_CONFIG_SELECT_GROUP_EXT,
1,
EGL_NONE,
};
for (int j = 0; dri2_dpy->driver_configs[j]; j++) {
const __DRIconfig *config = dri2_dpy->driver_configs[j];
int shifts[4];
@ -854,7 +864,12 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
continue;
}
dri2_add_config(disp, config, surface_type, config_attrs);
unsigned int bit_per_pixel = sizes[0] + sizes[1] + sizes[2] + sizes[3];
if (sizes[3] != 0 && d.data->depth == bit_per_pixel) {
dri2_add_config(disp, config, surface_type, config_attrs_2nd_group);
} else {
dri2_add_config(disp, config, surface_type, config_attrs);
}
}
}