gallium/hash_table: consolidate hash tables with pointer keys
[mesa.git] / src / gallium / drivers / vc4 / vc4_screen.c
index 2be0b6c3fbed6ffe8dea11c4803c9acd9fe05137..3b14681c42dc1ec32325c04f4b0f65fa8a337752 100644 (file)
@@ -437,18 +437,6 @@ vc4_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
        }
 }
 
-#define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x)))
-
-static unsigned handle_hash(void *key)
-{
-    return PTR_TO_UINT(key);
-}
-
-static int handle_compare(void *key1, void *key2)
-{
-    return PTR_TO_UINT(key1) != PTR_TO_UINT(key2);
-}
-
 static bool
 vc4_get_chip_info(struct vc4_screen *screen)
 {
@@ -525,7 +513,7 @@ vc4_screen_create(int fd, struct renderonly *ro)
 
         list_inithead(&screen->bo_cache.time_list);
         (void) mtx_init(&screen->bo_handles_mutex, mtx_plain);
-        screen->bo_handles = util_hash_table_create(handle_hash, handle_compare);
+        screen->bo_handles = util_hash_table_create_ptr_keys();
 
         screen->has_control_flow =
                 vc4_has_feature(screen, DRM_VC4_PARAM_SUPPORTS_BRANCHES);