egl/x11_dri3: enable & require xfixes 2.0
authorEric Engestrom <eric@engestrom.ch>
Sat, 8 Aug 2020 17:21:58 +0000 (19:21 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 19 Aug 2020 12:47:57 +0000 (12:47 +0000)
Cc: 20.2 <mesa-stable>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6132>

meson.build
src/egl/drivers/dri2/platform_x11_dri3.c

index cbd8e72d17636e52ac0d128125be95587ae8f71f..c7d878cb6e8a0894dea7bb732e516bc11cb11350 100644 (file)
@@ -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
index d645a2c027f6bea333b63c32ac429021a02fd488..5c69a3b981e4a0f50ad9c82fccaddc9ce5cb3fd8 100644 (file)
@@ -28,6 +28,7 @@
 #include <xcb/xcb.h>
 #include <xcb/dri3.h>
 #include <xcb/present.h>
+#include <xcb/xfixes.h>
 
 #include <xf86drm.h>
 #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);