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@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11461>
This commit is contained in:
Adam Jackson 2021-06-23 09:59:22 -04:00 committed by Marge Bot
parent 888b7ba338
commit 34e4622983
1 changed files with 9 additions and 0 deletions

View File

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