From eae181e3eb9cabd98a78e8440c81cd08e8a26778 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sat, 8 Aug 2020 19:21:58 +0200 Subject: [PATCH] egl/x11_dri3: enable & require xfixes 2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Cc: 20.2 Signed-off-by: Eric Engestrom Acked-by: Michel Dänzer Part-of: --- meson.build | 2 +- src/egl/drivers/dri2/platform_x11_dri3.c | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index cbd8e72d176..c7d878cb6e8 100644 --- a/meson.build +++ b/meson.build @@ -1716,7 +1716,7 @@ if with_platform_x11 dep_x11 = dependency('x11') dep_xext = dependency('xext') dep_xdamage = dependency('xdamage', version : '>= 1.1') - dep_xfixes = dependency('xfixes') + dep_xfixes = dependency('xfixes', version : '>= 2.0') dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1') dep_xcb_shm = dependency('xcb-shm') endif diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index d645a2c027f..5c69a3b981e 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "util/macros.h" @@ -514,11 +515,14 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy) xcb_dri3_query_version_cookie_t dri3_query_cookie; xcb_present_query_version_reply_t *present_query; xcb_present_query_version_cookie_t present_query_cookie; + xcb_xfixes_query_version_reply_t *xfixes_query; + xcb_xfixes_query_version_cookie_t xfixes_query_cookie; xcb_generic_error_t *error; const xcb_query_extension_reply_t *extension; xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_dri3_id); xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_present_id); + xcb_prefetch_extension_data (dri2_dpy->conn, &xcb_xfixes_id); extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_dri3_id); if (!(extension && extension->present)) @@ -528,6 +532,10 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy) if (!(extension && extension->present)) return EGL_FALSE; + extension = xcb_get_extension_data(dri2_dpy->conn, &xcb_xfixes_id); + if (!(extension && extension->present)) + return EGL_FALSE; + dri3_query_cookie = xcb_dri3_query_version(dri2_dpy->conn, DRI3_SUPPORTED_MAJOR, DRI3_SUPPORTED_MINOR); @@ -536,6 +544,10 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy) PRESENT_SUPPORTED_MAJOR, PRESENT_SUPPORTED_MINOR); + xfixes_query_cookie = xcb_xfixes_query_version(dri2_dpy->conn, + XCB_XFIXES_MAJOR_VERSION, + XCB_XFIXES_MINOR_VERSION); + dri3_query = xcb_dri3_query_version_reply(dri2_dpy->conn, dri3_query_cookie, &error); if (dri3_query == NULL || error != NULL) { @@ -563,6 +575,18 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy) dri2_dpy->present_minor_version = present_query->minor_version; free(present_query); + xfixes_query = + xcb_xfixes_query_version_reply(dri2_dpy->conn, + xfixes_query_cookie, &error); + if (xfixes_query == NULL || error != NULL || + xfixes_query->major_version < 2) { + _eglLog(_EGL_WARNING, "DRI3: failed to query xfixes version"); + free(error); + free(xfixes_query); + return EGL_FALSE; + } + free(xfixes_query); + dri2_dpy->fd = loader_dri3_open(dri2_dpy->conn, dri2_dpy->screen->root, 0); if (dri2_dpy->fd < 0) { int conn_error = xcb_connection_has_error(dri2_dpy->conn); -- 2.30.2