egl/x11_dri3: enable & require xfixes 2.0

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>
(cherry picked from commit eae181e3eb)
This commit is contained in:
Eric Engestrom 2020-08-08 19:21:58 +02:00 committed by Dylan Baker
parent 748a7e1a44
commit 99d5727d2d
3 changed files with 26 additions and 2 deletions

View file

@ -1228,7 +1228,7 @@
"description": "egl/x11_dri3: enable & require xfixes 2.0",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -1707,7 +1707,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')
endif
if (with_any_vk or with_glx == 'dri' or with_egl or

View 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"
@ -525,11 +526,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))
@ -539,6 +543,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);
@ -547,6 +555,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) {
@ -574,6 +586,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);