diff options
author | Marek Olšák <[email protected]> | 2020-02-05 14:27:21 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-26 20:35:50 +0000 |
commit | 76dff2fabe065b71f0d336cb43853335dd3eb82a (patch) | |
tree | 3328112d22bd34fa2310b3fb461bc87f7ddeab90 /src/gallium/winsys/freedreno | |
parent | a01a875081bd52bc1c3c142a60af678171ce6c33 (diff) |
gallium/hash_table: consolidate hash tables with FD keys
Reviewed-by: Kristian H. Kristensen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3722>
Diffstat (limited to 'src/gallium/winsys/freedreno')
-rw-r--r-- | src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c index 719c52a80c7..d09208bcb26 100644 --- a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c +++ b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c @@ -62,28 +62,6 @@ fd_drm_screen_destroy(struct pipe_screen *pscreen) } } -static unsigned hash_fd(void *key) -{ - int fd = pointer_to_intptr(key); - struct stat stat; - fstat(fd, &stat); - - return stat.st_dev ^ stat.st_ino ^ stat.st_rdev; -} - -static int compare_fd(void *key1, void *key2) -{ - int fd1 = pointer_to_intptr(key1); - int fd2 = pointer_to_intptr(key2); - struct stat stat1, stat2; - fstat(fd1, &stat1); - fstat(fd2, &stat2); - - return stat1.st_dev != stat2.st_dev || - stat1.st_ino != stat2.st_ino || - stat1.st_rdev != stat2.st_rdev; -} - struct pipe_screen * fd_drm_screen_create(int fd, struct renderonly *ro) { @@ -91,7 +69,7 @@ fd_drm_screen_create(int fd, struct renderonly *ro) mtx_lock(&fd_screen_mutex); if (!fd_tab) { - fd_tab = util_hash_table_create(hash_fd, compare_fd); + fd_tab = util_hash_table_create_fd_keys(); if (!fd_tab) goto unlock; } |