mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
drm-shim: fix shim on GLX
xcb_dri3_open_reply_fds will dup the fd received from the server, so we need to detect this case. Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40656>
This commit is contained in:
parent
2ec0925bc1
commit
d97688b6b3
1 changed files with 13 additions and 2 deletions
|
|
@ -805,8 +805,19 @@ fcntl(int fd, int cmd, ...)
|
|||
|
||||
int ret = real_fcntl(fd, cmd, arg);
|
||||
|
||||
if (shim_fd && (cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC))
|
||||
drm_shim_fd_register(ret, shim_fd);
|
||||
if (cmd == F_DUPFD || cmd == F_DUPFD_CLOEXEC) {
|
||||
if (shim_fd) {
|
||||
drm_shim_fd_register(ret, shim_fd);
|
||||
} else {
|
||||
/* x11_dri3_open / xcb_dri3_open_reply_fds will end up here. */
|
||||
drmVersionPtr ver = drmGetVersion(fd);
|
||||
if (ver) {
|
||||
drm_shim_fd_register(fd, NULL);
|
||||
drm_shim_fd_register(ret, drm_shim_fd_lookup(fd));
|
||||
drmFree(ver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue