aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/nouveau/drm
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-02-05 14:27:21 -0500
committerMarge Bot <[email protected]>2020-02-26 20:35:50 +0000
commit76dff2fabe065b71f0d336cb43853335dd3eb82a (patch)
tree3328112d22bd34fa2310b3fb461bc87f7ddeab90 /src/gallium/winsys/nouveau/drm
parenta01a875081bd52bc1c3c142a60af678171ce6c33 (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/nouveau/drm')
-rw-r--r--src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
index 3e790aa65d5..57f3702a3e0 100644
--- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
+++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
@@ -36,28 +36,6 @@ bool nouveau_drm_screen_unref(struct nouveau_screen *screen)
return ret == 0;
}
-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;
-}
-
PUBLIC struct pipe_screen *
nouveau_drm_screen_create(int fd)
{
@@ -69,7 +47,7 @@ nouveau_drm_screen_create(int fd)
mtx_lock(&nouveau_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) {
mtx_unlock(&nouveau_screen_mutex);
return NULL;