diff --git a/docs/_static/specs/EGL_MESA_x11_native_visual_id.txt b/docs/_static/specs/EGL_MESA_x11_native_visual_id.txt new file mode 100644 index 00000000000..de30c399ef0 --- /dev/null +++ b/docs/_static/specs/EGL_MESA_x11_native_visual_id.txt @@ -0,0 +1,80 @@ +Name + + MESA_x11_native_visual_id + +Name Strings + + EGL_MESA_x11_native_visual_id + +Contact + + Eric Engestrom + +Status + + Complete, shipping. + +Version + + Version 2, May 10, 2024 + +Number + + EGL Extension #TBD + +Extension Type + + EGL display extension + +Dependencies + + None. This extension is written against the + wording of the EGL 1.5 specification. + +Overview + + This extension allows EGL_NATIVE_VISUAL_ID to be used in + eglChooseConfig() for a display of type EGL_PLATFORM_X11_EXT. + +IP Status + + Open-source; freely implementable. + +New Types + + None + +New Procedures and Functions + + None + +New Tokens + + None + +In section 3.4.1.1 "Selection of EGLConfigs" of the EGL 1.5 +Specification, replace: + + If EGL_MAX_PBUFFER_WIDTH, EGL_MAX_PBUFFER_HEIGHT, + EGL_MAX_PBUFFER_PIXELS, or EGL_NATIVE_VISUAL_ID are specified in + attrib list, then they are ignored [...] + +with: + + If EGL_MAX_PBUFFER_WIDTH, EGL_MAX_PBUFFER_HEIGHT, + or EGL_MAX_PBUFFER_PIXELS are specified in attrib list, then they + are ignored [...]. EGL_NATIVE_VISUAL_ID is ignored except on + a display of type EGL_PLATFORM_X11_EXT when EGL_ALPHA_SIZE is + greater than zero. + +Issues + + None. + +Revision History + + Version 1, March 27, 2024 (Eric Engestrom) + Initial draft + Version 2, May 10, 2024 (David Heidelberg) + add EGL_ALPHA_SIZE condition + add Extension type and set it to display extension diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index fc15959f42d..959a9ecf0f8 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -288,6 +288,13 @@ dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type, static EGLBoolean dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria) { +#ifdef HAVE_X11_PLATFORM + if (conf->Display->Platform == _EGL_PLATFORM_X11 && + conf->AlphaSize > 0 && + conf->NativeVisualID != criteria->NativeVisualID) + return EGL_FALSE; +#endif + if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0) return EGL_FALSE; @@ -836,6 +843,8 @@ dri2_setup_screen(_EGLDisplay *disp) disp->Extensions.MESA_image_dma_buf_export = EGL_TRUE; } + disp->Extensions.MESA_x11_native_visual_id = EGL_TRUE; + disp->Extensions.KHR_image_base = EGL_TRUE; disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE; disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE; diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index f10f5f04e58..505083734c2 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -594,6 +594,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp) _EGL_CHECK_EXTENSION(MESA_gl_interop); _EGL_CHECK_EXTENSION(MESA_image_dma_buf_export); _EGL_CHECK_EXTENSION(MESA_query_driver); + _EGL_CHECK_EXTENSION(MESA_x11_native_visual_id); _EGL_CHECK_EXTENSION(NOK_swap_region); _EGL_CHECK_EXTENSION(NOK_texture_from_pixmap); diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 4a07166cd01..e7a5c429fd6 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -146,6 +146,7 @@ struct _egl_extensions { EGLBoolean MESA_gl_interop; EGLBoolean MESA_image_dma_buf_export; EGLBoolean MESA_query_driver; + EGLBoolean MESA_x11_native_visual_id; EGLBoolean NOK_swap_region; EGLBoolean NOK_texture_from_pixmap;