Mesa (main): loader/dri3: Properly initialize the XFIXES extension

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 24 03:52:35 UTC 2021


Module: Mesa
Branch: main
Commit: 34e4622983b70baf8e565502de1d63df71b066a7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=34e4622983b70baf8e565502de1d63df71b066a7

Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Jun 23 09:59:22 2021 -0400

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 <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11461>

---

 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;
 }
 



More information about the mesa-commit mailing list