u_pipe_screen_lookup_or_create: avoid re-querying the fd to have a consistent hash key

In every current driver, the fd we get back from the screen is the fd we
gave to screen_create() three lines above (or a dup() thereof, which we
consider to be the same since we look inside it for the file description
instead).

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>
This commit is contained in:
Eric Engestrom
2022-12-15 14:54:51 +00:00
committed by Marge Bot
parent cd152ec930
commit 1e73fd4aa8
+1 -2
View File
@@ -653,8 +653,7 @@ u_pipe_screen_lookup_or_create(int gpu_fd,
pscreen = screen_create(gpu_fd, config, ro);
if (pscreen) {
pscreen->refcnt = 1;
int fd = pscreen->get_screen_fd(pscreen);
_mesa_hash_table_insert(fd_tab, intptr_to_pointer(fd), pscreen);
_mesa_hash_table_insert(fd_tab, intptr_to_pointer(gpu_fd), pscreen);
/* Bit of a hack, to avoid circular linkage dependency,
* ie. pipe driver having to call in to winsys, we