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>
This commit is contained in:
Eric Engestrom 2020-08-08 19:21:58 +02:00 committed by Marge Bot
parent 6c9cf84409
commit eae181e3eb
2 changed files with 25 additions and 1 deletions

View 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

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"
@ -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);