diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index e69de29bb2d..308563d8779 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -0,0 +1 @@ +EGL_MESA_platform_xcb diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index a1e5e946899..a911e40c933 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -883,6 +883,12 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, #define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 #endif /* EGL_EXT_platform_x11 */ +#ifndef EGL_MESA_platform_xcb +#define EGL_MESA_platform_xcb 1 +#define EGL_PLATFORM_XCB_EXT 0x31DC +#define EGL_PLATFORM_XCB_SCREEN_EXT 0x31DE +#endif /* EGL_MESA_platform_xcb */ + #ifndef EGL_EXT_protected_content #define EGL_EXT_protected_content 1 #define EGL_PROTECTED_CONTENT_EXT 0x32C0 diff --git a/meson.build b/meson.build index d8ac6e87e06..9bebca0742f 100644 --- a/meson.build +++ b/meson.build @@ -827,6 +827,7 @@ gl_pkgconfig_c_flags = [] if with_platform_x11 if with_any_vk or with_egl or (with_glx == 'dri' and with_dri_platform == 'drm') pre_args += '-DHAVE_X11_PLATFORM' + pre_args += '-DHAVE_XCB_PLATFORM' endif if with_glx == 'xlib' or with_glx == 'gallium-xlib' pre_args += '-DUSE_XSHM' diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 82c8442d452..a4164cccb8e 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -183,6 +183,11 @@ dri_is_thread_safe(void *loaderPrivate) return false; #endif +#ifdef HAVE_XCB_PLATFORM + if (display->Platform == _EGL_PLATFORM_XCB) + return true; +#endif + #ifdef HAVE_WAYLAND_PLATFORM if (display->Platform == _EGL_PLATFORM_WAYLAND) return true; @@ -1178,6 +1183,7 @@ dri2_initialize(_EGLDisplay *disp) ret = dri2_initialize_device(disp); break; case _EGL_PLATFORM_X11: + case _EGL_PLATFORM_XCB: ret = dri2_initialize_x11(disp); break; case _EGL_PLATFORM_DRM: diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index af79eb1df6d..f61267af2aa 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1212,7 +1212,8 @@ dri2_find_screen_for_display(const _EGLDisplay *disp, int fallback_screen) const EGLAttrib *attr; for (attr = disp->Options.Attribs; attr; attr += 2) { - if (attr[0] == EGL_PLATFORM_X11_SCREEN_EXT) + if (attr[0] == EGL_PLATFORM_X11_SCREEN_EXT || + attr[0] == EGL_PLATFORM_XCB_SCREEN_EXT) return attr[1]; } @@ -1232,10 +1233,14 @@ dri2_get_xcb_connection(_EGLDisplay *disp, dri2_dpy->conn = xcb_connect(NULL, &screen); dri2_dpy->own_device = true; screen = dri2_find_screen_for_display(disp, screen); - } else { + } else if (disp->Platform == _EGL_PLATFORM_X11) { Display *dpy = disp->PlatformDisplay; dri2_dpy->conn = XGetXCBConnection(dpy); screen = DefaultScreen(dpy); + } else { + /* _EGL_PLATFORM_XCB */ + dri2_dpy->conn = disp->PlatformDisplay; + screen = dri2_find_screen_for_display(disp, 0); } if (!dri2_dpy->conn || xcb_connection_has_error(dri2_dpy->conn)) { diff --git a/src/egl/generate/egl.xml b/src/egl/generate/egl.xml index d354a1ee7aa..106d4f3fadc 100644 --- a/src/egl/generate/egl.xml +++ b/src/egl/generate/egl.xml @@ -590,9 +590,10 @@ - + - + +