From 34e4622983b70baf8e565502de1d63df71b066a7 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 23 Jun 2021 09:59:22 -0400 Subject: [PATCH] loader/dri3: Properly initialize the XFIXES extension The server starts off assuming the only XFIXES request the client might known is FixesQueryVersion, and based on the version number the client supplies it unlocks additional requests. If you forget to do this then xcb_xfixes_create_region will throw BadRequest and you will be very confused. libXfixes would hide this for you in extension setup but xcb is not so forgiving. Reviewed-By: Mike Blumenkrantz Part-of: --- src/loader/loader_dri3_helper.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 6428ee5422a..cd648545e47 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -1150,6 +1150,8 @@ loader_dri3_open(xcb_connection_t *conn, { xcb_dri3_open_cookie_t cookie; xcb_dri3_open_reply_t *reply; + xcb_xfixes_query_version_cookie_t fixes_cookie; + xcb_xfixes_query_version_reply_t *fixes_reply; int fd; cookie = xcb_dri3_open(conn, @@ -1169,6 +1171,13 @@ loader_dri3_open(xcb_connection_t *conn, free(reply); fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); + /* let the server know our xfixes level */ + fixes_cookie = xcb_xfixes_query_version(conn, + XCB_XFIXES_MAJOR_VERSION, + XCB_XFIXES_MINOR_VERSION); + fixes_reply = xcb_xfixes_query_version_reply(conn, fixes_cookie, NULL); + free(fixes_reply); + return fd; }