egl/drm: Support RGB[A]16_UNORM formats for display.

Use the EGL_EXT_config_select_group extension to put these 16 bpc
unorm formats into a lower priority config select group 1, so they
don't get preferably chosen by default by eglChooseConfig(), but must
be explicitely requested by client applications which really need the
high color precision of these 64 bpp formats and are happy to pay the
potential performance impact.

Tested to work with the GBM backend directly on a VT by running kmscube
as drm master on a AMD Polaris gpu. drm_info reports proper formats for
the DRM framebuffers.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38588>
This commit is contained in:
Mario Kleiner 2025-11-28 05:35:55 +00:00 committed by Marge Bot
parent cf9ab823eb
commit 171f484eb0

View file

@ -540,13 +540,22 @@ drm_add_configs_for_visuals(_EGLDisplay *disp)
for (unsigned j = 0; j < num_visuals; j++) {
struct dri2_egl_config *dri2_conf;
EGLint config_group = 0;
if (visuals[j].pipe_format != gl_config->color_format)
continue;
/* Put the 16 bpc rgb[a] unorm formats into a lower priority EGL config
* group 1, so they don't get preferably chosen by eglChooseConfig().
*/
if (util_format_is_unorm16(util_format_description(visuals[j].pipe_format)))
config_group = 1;
const EGLint attr_list[] = {
EGL_NATIVE_VISUAL_ID,
visuals[j].gbm_format,
EGL_CONFIG_SELECT_GROUP_EXT,
config_group,
EGL_NONE,
};