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

Author: Eric Engestrom <[email protected]>
Date:   Thu Dec 15 14:54:51 2022 +0000

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 <[email protected]>
Reviewed-by: Jose Maria Casanova Crespo <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20180>

---

 src/gallium/auxiliary/util/u_screen.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_screen.c 
b/src/gallium/auxiliary/util/u_screen.c
index 235b544f5a3..8c8a66ca118 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -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

Reply via email to