From 171f484eb059461806aed9853a4a8728e50481f2 Mon Sep 17 00:00:00 2001 From: Mario Kleiner Date: Fri, 28 Nov 2025 05:35:55 +0000 Subject: [PATCH] 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 Reviewed-by: Adam Jackson Part-of: --- src/egl/drivers/dri2/platform_drm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 334e57ad57a..d9b194ad4e8 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -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, };