gallium/hash_table: remove some function wrappers
authorMarek Olšák <marek.olsak@amd.com>
Wed, 5 Feb 2020 19:52:38 +0000 (14:52 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 26 Feb 2020 20:35:50 +0000 (20:35 +0000)
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3722>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3722>

32 files changed:
src/gallium/auxiliary/pipebuffer/pb_validate.c
src/gallium/auxiliary/util/u_debug_flush.c
src/gallium/auxiliary/util/u_debug_refcnt.c
src/gallium/auxiliary/util/u_debug_stack.c
src/gallium/auxiliary/util/u_debug_symbol.c
src/gallium/auxiliary/util/u_hash_table.c
src/gallium/auxiliary/util/u_hash_table.h
src/gallium/drivers/lima/lima_bo.c
src/gallium/drivers/v3d/v3d_bufmgr.c
src/gallium/drivers/v3d/v3d_bufmgr.h
src/gallium/drivers/v3d/v3d_screen.c
src/gallium/drivers/vc4/vc4_bufmgr.c
src/gallium/drivers/vc4/vc4_bufmgr.h
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/iunknown.c
src/gallium/state_trackers/nine/nine_ff.c
src/gallium/state_trackers/omx/tizonia/h264dprc.c
src/gallium/state_trackers/va/context.c
src/gallium/state_trackers/va/picture_h264_enc.c
src/gallium/state_trackers/va/picture_hevc_enc.c
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c
src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c
src/gallium/winsys/lima/drm/lima_drm_winsys.c
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
src/gallium/winsys/radeon/drm/radeon_drm_bo.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
src/gallium/winsys/svga/drm/vmw_context.c
src/gallium/winsys/svga/drm/vmw_screen.c
src/gallium/winsys/virgl/drm/virgl_drm_winsys.c

index df334693c01b5d635991e13a94f574189e5af6f6..404bdfcec51f4873713137c4a44fec741598bc07 100644 (file)
@@ -118,7 +118,7 @@ pb_validate_add_buffer(struct pb_validate *vl,
    ++vl->used;
 
    if (ht)
-      util_hash_table_set(ht, buf, (void *) (unsigned long) vl->used);
+      _mesa_hash_table_insert(ht, buf, (void *) (unsigned long) vl->used);
 
    return PIPE_OK;
 }
index f525d6a5d304bd2e2b2e1dbd332555bc3e58a3e3..b8f6870f0a1785993e16561652c4819e7d27fba9 100644 (file)
@@ -323,10 +323,7 @@ debug_flush_cb_reference(struct debug_flush_ctx *fctx,
          debug_flush_buf_reference(&item->fbuf, fbuf);
          item->bt_depth = fctx->bt_depth;
          item->ref_frame = debug_flush_capture_frame(2, item->bt_depth);
-         if (util_hash_table_set(fctx->ref_hash, fbuf, item) != PIPE_OK) {
-            debug_flush_item_destroy(item);
-            goto out_no_item;
-         }
+         _mesa_hash_table_insert(fctx->ref_hash, fbuf, item);
          return;
       }
       goto out_no_item;
@@ -409,7 +406,7 @@ debug_flush_flush(struct debug_flush_ctx *fctx)
    util_hash_table_foreach(fctx->ref_hash,
                            debug_flush_flush_cb,
                            NULL);
-   util_hash_table_clear(fctx->ref_hash);
+   _mesa_hash_table_clear(fctx->ref_hash, NULL);
 }
 
 void
@@ -422,8 +419,8 @@ debug_flush_ctx_destroy(struct debug_flush_ctx *fctx)
    util_hash_table_foreach(fctx->ref_hash,
                            debug_flush_flush_cb,
                            NULL);
-   util_hash_table_clear(fctx->ref_hash);
-   util_hash_table_destroy(fctx->ref_hash);
+   _mesa_hash_table_clear(fctx->ref_hash, NULL);
+   _mesa_hash_table_destroy(fctx->ref_hash, NULL);
    FREE(fctx);
 }
 #endif
index a4612a40f6648cb69ffb34e1c09f2f032bf740ff..e0d2385bec7c4a4dd3bf1617b795cb7753a7fa11 100644 (file)
@@ -90,7 +90,7 @@ debug_serial(void *p, unsigned *pserial)
          os_abort();
       }
 
-      util_hash_table_set(serials_hash, p, (void *) (uintptr_t) serial);
+      _mesa_hash_table_insert(serials_hash, p, (void *) (uintptr_t) serial);
       found = FALSE;
    }
    mtx_unlock(&serials_mutex);
@@ -108,7 +108,7 @@ static void
 debug_serial_delete(void *p)
 {
    mtx_lock(&serials_mutex);
-   util_hash_table_remove(serials_hash, p);
+   _mesa_hash_table_remove_key(serials_hash, p);
    mtx_unlock(&serials_mutex);
 }
 
index 34d493b4cee27324b13f5bdbb07e7c9126a8c509..44581e0a3fba8d49e9d12d3c8051ec80f2f53f6d 100644 (file)
@@ -77,7 +77,7 @@ symbol_name_cached(unw_cursor_t *cursor, unw_proc_info_t *pip)
 
       if (asprintf(&name, "%s%s", procname, ret == -UNW_ENOMEM ? "..." : "") == -1) 
          name = "??";
-      util_hash_table_set(symbols_hash, addr, (void*)name);
+      _mesa_hash_table_insert(symbols_hash, addr, (void*)name);
    }
    mtx_unlock(&symbols_mutex);
 
index a1d4a5f23ae01bc937a13fd75e9d97cc8b988abe..f576a51fe990956565cddcbd556c4fb4c77a1c4e 100644 (file)
@@ -296,7 +296,7 @@ debug_symbol_name_cached(const void *addr)
       debug_symbol_name(addr, buf, sizeof(buf));
       name = strdup(buf);
 
-      util_hash_table_set(symbols_hash, (void*)addr, (void*)name);
+      _mesa_hash_table_insert(symbols_hash, (void*)addr, (void*)name);
    }
    mtx_unlock(&symbols_mutex);
    return name;
index 59c8c6cf98dc07c1935e434ac53fa877e9c82bd7..9182da55800268a1ab15f34db1be03d85b068a18 100644 (file)
  **************************************************************************/
 
 
-#include "pipe/p_compiler.h"
-#include "util/u_debug.h"
-
-#include "util/u_memory.h"
+#include "util/u_pointer.h"
 #include "util/u_hash_table.h"
-#include "util/hash_table.h"
 
 #if DETECT_OS_UNIX
 #include <sys/stat.h>
 #endif
 
 
-struct hash_table *
-util_hash_table_create(uint32_t (*hash)(const void *key),
-                       bool (*equal)(const void *key1, const void *key2))
-{
-   return _mesa_hash_table_create(NULL, hash, equal);
-}
-
-
 static uint32_t
 pointer_hash(const void *key)
 {
@@ -108,16 +96,6 @@ util_hash_table_create_fd_keys(void)
 }
 
 
-enum pipe_error
-util_hash_table_set(struct hash_table *ht,
-                    void *key,
-                    void *value)
-{
-   _mesa_hash_table_insert(ht, key, value);
-   return PIPE_OK;
-}
-
-
 void *
 util_hash_table_get(struct hash_table *ht,
                     void *key)
@@ -128,21 +106,6 @@ util_hash_table_get(struct hash_table *ht,
 }
 
 
-void
-util_hash_table_remove(struct hash_table *ht,
-                       void *key)
-{
-   _mesa_hash_table_remove_key(ht, key);
-}
-
-
-void 
-util_hash_table_clear(struct hash_table *ht)
-{
-   _mesa_hash_table_clear(ht, NULL);
-}
-
-
 enum pipe_error
 util_hash_table_foreach(struct hash_table *ht,
                         enum pipe_error (*callback)
@@ -156,17 +119,3 @@ util_hash_table_foreach(struct hash_table *ht,
    }
    return PIPE_OK;
 }
-
-
-size_t
-util_hash_table_count(struct hash_table *ht)
-{
-   return _mesa_hash_table_num_entries(ht);
-}
-
-
-void
-util_hash_table_destroy(struct hash_table *ht)
-{
-   _mesa_hash_table_destroy(ht, NULL);
-}
index 46470bf06474951786f28d50daec075f0747bb65..4be4cef30506b9ea58eb630209f175e905d49de8 100644 (file)
 
 
 #include "pipe/p_defines.h"
+#include "util/hash_table.h"
 
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-struct hash_table;
-
-
-/**
- * Create an hash table.
- * 
- * @param hash hash function
- * @param equal should return true for two equal keys.
- */
-struct hash_table *
-util_hash_table_create(uint32_t (*hash)(const void *key),
-                       bool (*equal)(const void *key1, const void *key2));
-
 /**
  * Create a hash table where the keys are generic pointers.
  */
@@ -67,40 +55,17 @@ struct hash_table *
 util_hash_table_create_fd_keys(void);
 
 
-enum pipe_error
-util_hash_table_set(struct hash_table *ht,
-                    void *key,
-                    void *value);
-
 void *
 util_hash_table_get(struct hash_table *ht,
                     void *key);
 
 
-void
-util_hash_table_remove(struct hash_table *ht,
-                       void *key);
-
-
-void
-util_hash_table_clear(struct hash_table *ht);
-
-
 enum pipe_error
 util_hash_table_foreach(struct hash_table *ht,
                         enum pipe_error (*callback)
                         (void *key, void *value, void *data),
                         void *data);
 
-
-size_t
-util_hash_table_count(struct hash_table *ht);
-
-
-void
-util_hash_table_destroy(struct hash_table *ht);
-
-
 #ifdef __cplusplus
 }
 #endif
index 17197c482796e64a5dde5ae1f1a8ec8532f8f5a1..cccf2f64cac795238f86a3d292b51ce964ca5473 100644 (file)
@@ -54,7 +54,7 @@ bool lima_bo_table_init(struct lima_screen *screen)
    return true;
 
 err_out0:
-   util_hash_table_destroy(screen->bo_handles);
+   _mesa_hash_table_destroy(screen->bo_handles, NULL);
    return false;
 }
 
@@ -71,8 +71,8 @@ bool lima_bo_cache_init(struct lima_screen *screen)
 void lima_bo_table_fini(struct lima_screen *screen)
 {
    mtx_destroy(&screen->bo_table_lock);
-   util_hash_table_destroy(screen->bo_handles);
-   util_hash_table_destroy(screen->bo_flink_names);
+   _mesa_hash_table_destroy(screen->bo_handles, NULL);
+   _mesa_hash_table_destroy(screen->bo_flink_names, NULL);
 }
 
 static void
@@ -101,10 +101,10 @@ lima_bo_free(struct lima_bo *bo)
               bo, bo->size);
 
    mtx_lock(&screen->bo_table_lock);
-   util_hash_table_remove(screen->bo_handles,
+   _mesa_hash_table_remove_key(screen->bo_handles,
                           (void *)(uintptr_t)bo->handle);
    if (bo->flink_name)
-      util_hash_table_remove(screen->bo_flink_names,
+      _mesa_hash_table_remove_key(screen->bo_flink_names,
                              (void *)(uintptr_t)bo->flink_name);
    mtx_unlock(&screen->bo_table_lock);
 
@@ -378,7 +378,7 @@ bool lima_bo_export(struct lima_bo *bo, struct winsys_handle *handle)
          bo->flink_name = flink.name;
 
          mtx_lock(&screen->bo_table_lock);
-         util_hash_table_set(screen->bo_flink_names,
+         _mesa_hash_table_insert(screen->bo_flink_names,
                              (void *)(uintptr_t)bo->flink_name, bo);
          mtx_unlock(&screen->bo_table_lock);
       }
@@ -387,7 +387,7 @@ bool lima_bo_export(struct lima_bo *bo, struct winsys_handle *handle)
 
    case WINSYS_HANDLE_TYPE_KMS:
       mtx_lock(&screen->bo_table_lock);
-      util_hash_table_set(screen->bo_handles,
+      _mesa_hash_table_insert(screen->bo_handles,
                           (void *)(uintptr_t)bo->handle, bo);
       mtx_unlock(&screen->bo_table_lock);
 
@@ -400,7 +400,7 @@ bool lima_bo_export(struct lima_bo *bo, struct winsys_handle *handle)
          return false;
 
       mtx_lock(&screen->bo_table_lock);
-      util_hash_table_set(screen->bo_handles,
+      _mesa_hash_table_insert(screen->bo_handles,
                           (void *)(uintptr_t)bo->handle, bo);
       mtx_unlock(&screen->bo_table_lock);
       return true;
@@ -504,9 +504,9 @@ struct lima_bo *lima_bo_import(struct lima_screen *screen,
 
    if (lima_bo_get_info(bo)) {
       if (handle->type == WINSYS_HANDLE_TYPE_SHARED)
-         util_hash_table_set(screen->bo_flink_names,
+         _mesa_hash_table_insert(screen->bo_flink_names,
                           (void *)(uintptr_t)bo->flink_name, bo);
-      util_hash_table_set(screen->bo_handles,
+      _mesa_hash_table_insert(screen->bo_handles,
                           (void*)(uintptr_t)bo->handle, bo);
    }
    else {
index b3e4d053cc030e662d07a6a59fdba583ee63b254..50e4081dafda444b71ffadf6569ea73309ff6da7 100644 (file)
@@ -372,7 +372,7 @@ v3d_bo_open_handle(struct v3d_screen *screen,
         bo->offset = get.offset;
         assert(bo->offset != 0);
 
-        util_hash_table_set(screen->bo_handles, (void *)(uintptr_t)handle, bo);
+        _mesa_hash_table_insert(screen->bo_handles, (void *)(uintptr_t)handle, bo);
 
         screen->bo_count++;
         screen->bo_size += bo->size;
@@ -433,7 +433,7 @@ v3d_bo_get_dmabuf(struct v3d_bo *bo)
 
         mtx_lock(&bo->screen->bo_handles_mutex);
         bo->private = false;
-        util_hash_table_set(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
+        _mesa_hash_table_insert(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
         mtx_unlock(&bo->screen->bo_handles_mutex);
 
         return fd;
index 48629c653560cac6e387e31b62c405012e17c363..9aa4d84a0014aac210320c4fded19f64fdcc0167 100644 (file)
@@ -96,7 +96,7 @@ v3d_bo_unreference(struct v3d_bo **bo)
                 mtx_lock(&screen->bo_handles_mutex);
 
                 if (pipe_reference(&(*bo)->reference, NULL)) {
-                        util_hash_table_remove(screen->bo_handles,
+                        _mesa_hash_table_remove_key(screen->bo_handles,
                                                (void *)(uintptr_t)(*bo)->handle);
                         v3d_bo_last_unreference(*bo);
                 }
index 8031ea727e07681f4626e0aec3039a636943d5f2..8e2509a71c4ebcd4ff643c592cafc63970d282c2 100644 (file)
@@ -72,7 +72,7 @@ v3d_screen_destroy(struct pipe_screen *pscreen)
 {
         struct v3d_screen *screen = v3d_screen(pscreen);
 
-        util_hash_table_destroy(screen->bo_handles);
+        _mesa_hash_table_destroy(screen->bo_handles, NULL);
         v3d_bufmgr_destroy(pscreen);
         slab_destroy_parent(&screen->transfer_pool);
         free(screen->ro);
index 5ec360934c071692952faa5d5032b70b96d769bc..549c4f8f43d94d81d600445e5ff7adc753b6c592 100644 (file)
@@ -413,7 +413,7 @@ vc4_bo_open_handle(struct vc4_screen *screen,
         bo->map = malloc(bo->size);
 #endif
 
-        util_hash_table_set(screen->bo_handles, (void *)(uintptr_t)handle, bo);
+        _mesa_hash_table_insert(screen->bo_handles, (void *)(uintptr_t)handle, bo);
 
 done:
         mtx_unlock(&screen->bo_handles_mutex);
@@ -471,7 +471,7 @@ vc4_bo_get_dmabuf(struct vc4_bo *bo)
 
         mtx_lock(&bo->screen->bo_handles_mutex);
         bo->private = false;
-        util_hash_table_set(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
+        _mesa_hash_table_insert(bo->screen->bo_handles, (void *)(uintptr_t)bo->handle, bo);
         mtx_unlock(&bo->screen->bo_handles_mutex);
 
         return fd;
index 30a388ee59913e8beb1cbbb77107fd9d1612670f..26378cb4840e08b009bb0ce9cbf7f8e045366e36 100644 (file)
@@ -102,7 +102,7 @@ vc4_bo_unreference(struct vc4_bo **bo)
                 if (pipe_reference_described(&(*bo)->reference, NULL,
                                              (debug_reference_descriptor)
                                              vc4_bo_debug_describe)) {
-                        util_hash_table_remove(screen->bo_handles,
+                        _mesa_hash_table_remove_key(screen->bo_handles,
                                                (void *)(uintptr_t)(*bo)->handle);
                         vc4_bo_last_unreference(*bo);
                 }
index 3b14681c42dc1ec32325c04f4b0f65fa8a337752..21db4c944ff12d0d17755909611a96ac18233ee8 100644 (file)
@@ -102,7 +102,7 @@ vc4_screen_destroy(struct pipe_screen *pscreen)
 {
         struct vc4_screen *screen = vc4_screen(pscreen);
 
-        util_hash_table_destroy(screen->bo_handles);
+        _mesa_hash_table_destroy(screen->bo_handles, NULL);
         vc4_bufmgr_destroy(pscreen);
         slab_destroy_parent(&screen->transfer_pool);
         free(screen->ro);
index bac92c445864483c67217a495632b236d654cf72..c5b5eff128e9024a92bfe7f5cd4be13c0b7a38e8 100644 (file)
@@ -3023,7 +3023,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This,
             if (FAILED(hr))
                 return hr;
             vdecl->fvf = FVF;
-            util_hash_table_set(This->ff.ht_fvf, &vdecl->fvf, vdecl);
+            _mesa_hash_table_insert(This->ff.ht_fvf, &vdecl->fvf, vdecl);
             NineUnknown_ConvertRefToBind(NineUnknown(vdecl));
         }
     }
@@ -3183,7 +3183,7 @@ NineDevice9_SetFVF( struct NineDevice9 *This,
         if (FAILED(hr))
             return hr;
         vdecl->fvf = FVF;
-        util_hash_table_set(This->ff.ht_fvf, &vdecl->fvf, vdecl);
+        _mesa_hash_table_insert(This->ff.ht_fvf, &vdecl->fvf, vdecl);
         NineUnknown_ConvertRefToBind(NineUnknown(vdecl));
     }
     return NineDevice9_SetVertexDeclaration(
index 3835651f5367ab5b224580eafc91e86ef35854af..2d69afd5496111788c2b093a6420dfd08aae1231 100644 (file)
@@ -59,7 +59,7 @@ NineUnknown_ctor( struct NineUnknown *This,
     This->guids = pParams->guids;
     This->dtor = pParams->dtor;
 
-    This->pdata = util_hash_table_create(ht_guid_hash, ht_guid_compare);
+    This->pdata = _mesa_hash_table_create(NULL, ht_guid_hash, ht_guid_compare);
     if (!This->pdata)
         return E_OUTOFMEMORY;
 
@@ -74,7 +74,7 @@ NineUnknown_dtor( struct NineUnknown *This )
 
     if (This->pdata) {
         util_hash_table_foreach(This->pdata, ht_guid_delete, NULL);
-        util_hash_table_destroy(This->pdata);
+        _mesa_hash_table_destroy(This->pdata, NULL);
     }
 
     FREE(This);
@@ -224,16 +224,9 @@ NineUnknown_SetPrivateData( struct NineUnknown *This,
     memcpy(header_data, user_data, header->size);
     memcpy(&header->guid, refguid, sizeof(header->guid));
 
-    err = util_hash_table_set(This->pdata, &header->guid, header);
-    if (err == PIPE_OK) {
-        if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
-        return D3D_OK;
-    }
-
-    FREE(header);
-    if (err == PIPE_ERROR_OUT_OF_MEMORY) { return E_OUTOFMEMORY; }
-
-    return D3DERR_DRIVERINTERNALERROR;
+    _mesa_hash_table_insert(This->pdata, &header->guid, header);
+    if (header->unknown) { IUnknown_AddRef(*(IUnknown **)header_data); }
+    return D3D_OK;
 }
 
 HRESULT NINE_WINAPI
@@ -289,7 +282,7 @@ NineUnknown_FreePrivateData( struct NineUnknown *This,
         return D3DERR_NOTFOUND;
 
     ht_guid_delete(NULL, header, NULL);
-    util_hash_table_remove(This->pdata, refguid);
+    _mesa_hash_table_remove_key(This->pdata, refguid);
 
     return D3D_OK;
 }
index 8973dcbbc28d86a51ad7d9aa83ec78cc107243a2..a97a83ff1c3968e5228ca33cb57552c1d43f43c5 100644 (file)
@@ -1563,7 +1563,6 @@ nine_ff_get_vs(struct NineDevice9 *device)
 {
     const struct nine_context *context = &device->context;
     struct NineVertexShader9 *vs;
-    enum pipe_error err;
     struct vs_build_ctx bld;
     struct nine_ff_vs_key key;
     unsigned s, i;
@@ -1695,9 +1694,7 @@ nine_ff_get_vs(struct NineDevice9 *device)
 
         memcpy(&vs->ff_key, &key, sizeof(vs->ff_key));
 
-        err = util_hash_table_set(device->ff.ht_vs, &vs->ff_key, vs);
-        (void)err;
-        assert(err == PIPE_OK);
+        _mesa_hash_table_insert(device->ff.ht_vs, &vs->ff_key, vs);
         device->ff.num_vs++;
 
         vs->num_inputs = bld.num_inputs;
@@ -1719,7 +1716,6 @@ nine_ff_get_ps(struct NineDevice9 *device)
     struct nine_context *context = &device->context;
     D3DMATRIX *projection_matrix = GET_D3DTS(PROJECTION);
     struct NinePixelShader9 *ps;
-    enum pipe_error err;
     struct nine_ff_ps_key key;
     unsigned s;
     uint8_t sampler_mask = 0;
@@ -1847,9 +1843,7 @@ nine_ff_get_ps(struct NineDevice9 *device)
     if (ps) {
         memcpy(&ps->ff_key, &key, sizeof(ps->ff_key));
 
-        err = util_hash_table_set(device->ff.ht_ps, &ps->ff_key, ps);
-        (void)err;
-        assert(err == PIPE_OK);
+        _mesa_hash_table_insert(device->ff.ht_ps, &ps->ff_key, ps);
         device->ff.num_ps++;
 
         ps->rt_mask = 0x1;
@@ -2089,13 +2083,13 @@ nine_ff_update(struct NineDevice9 *device)
 boolean
 nine_ff_init(struct NineDevice9 *device)
 {
-    device->ff.ht_vs = util_hash_table_create(nine_ff_vs_key_hash,
-                                              nine_ff_vs_key_comp);
-    device->ff.ht_ps = util_hash_table_create(nine_ff_ps_key_hash,
-                                              nine_ff_ps_key_comp);
+    device->ff.ht_vs = _mesa_hash_table_create(NULL, nine_ff_vs_key_hash,
+                                               nine_ff_vs_key_comp);
+    device->ff.ht_ps = _mesa_hash_table_create(NULL, nine_ff_ps_key_hash,
+                                               nine_ff_ps_key_comp);
 
-    device->ff.ht_fvf = util_hash_table_create(nine_ff_fvf_key_hash,
-                                               nine_ff_fvf_key_comp);
+    device->ff.ht_fvf = _mesa_hash_table_create(NULL, nine_ff_fvf_key_hash,
+                                                nine_ff_fvf_key_comp);
 
     device->ff.vs_const = CALLOC(NINE_FF_NUM_VS_CONST, 4 * sizeof(float));
     device->ff.ps_const = CALLOC(NINE_FF_NUM_PS_CONST, 4 * sizeof(float));
@@ -2116,15 +2110,15 @@ nine_ff_fini(struct NineDevice9 *device)
 {
     if (device->ff.ht_vs) {
         util_hash_table_foreach(device->ff.ht_vs, nine_ff_ht_delete_cb, NULL);
-        util_hash_table_destroy(device->ff.ht_vs);
+        _mesa_hash_table_destroy(device->ff.ht_vs, NULL);
     }
     if (device->ff.ht_ps) {
         util_hash_table_foreach(device->ff.ht_ps, nine_ff_ht_delete_cb, NULL);
-        util_hash_table_destroy(device->ff.ht_ps);
+        _mesa_hash_table_destroy(device->ff.ht_ps, NULL);
     }
     if (device->ff.ht_fvf) {
         util_hash_table_foreach(device->ff.ht_fvf, nine_ff_ht_delete_cb, NULL);
-        util_hash_table_destroy(device->ff.ht_fvf);
+        _mesa_hash_table_destroy(device->ff.ht_fvf, NULL);
     }
     device->ff.vs = NULL; /* destroyed by unbinding from hash table */
     device->ff.ps = NULL;
@@ -2142,7 +2136,7 @@ nine_ff_prune_vs(struct NineDevice9 *device)
         /* could destroy the bound one here, so unbind */
         context->pipe->bind_vs_state(context->pipe, NULL);
         util_hash_table_foreach(device->ff.ht_vs, nine_ff_ht_delete_cb, NULL);
-        util_hash_table_clear(device->ff.ht_vs);
+        _mesa_hash_table_clear(device->ff.ht_vs, NULL);
         device->ff.num_vs = 0;
         context->changed.group |= NINE_STATE_VS;
     }
@@ -2156,7 +2150,7 @@ nine_ff_prune_ps(struct NineDevice9 *device)
         /* could destroy the bound one here, so unbind */
         context->pipe->bind_fs_state(context->pipe, NULL);
         util_hash_table_foreach(device->ff.ht_ps, nine_ff_ht_delete_cb, NULL);
-        util_hash_table_clear(device->ff.ht_ps);
+        _mesa_hash_table_clear(device->ff.ht_ps, NULL);
         device->ff.num_ps = 0;
         context->changed.group |= NINE_STATE_PS;
     }
index 5678bd7ac8c535b29898321ae49a542d41e5f9d9..c5df994b8c3d5fae052d1dd931d2c033a68059cf 100644 (file)
@@ -217,7 +217,7 @@ static void get_eglimage(vid_dec_PrivateType* priv) {
         assert(video_buffer);
         assert(video_buffer->buffer_format == p_res->format);
 
-        util_hash_table_set(priv->video_buffer_map, priv->p_outhdr_, video_buffer);
+        _mesa_hash_table_insert(priv->video_buffer_map, priv->p_outhdr_, video_buffer);
       }
    } else {
       (void) tiz_krn_release_buffer(tiz_get_krn (handleOf (priv)),
@@ -436,7 +436,7 @@ static OMX_ERRORTYPE h264d_prc_deallocate_resources(void *ap_obj)
    util_hash_table_foreach(priv->video_buffer_map,
                             &hash_table_clear_item_callback,
                             NULL);
-   util_hash_table_destroy(priv->video_buffer_map);
+   _mesa_hash_table_destroy(priv->video_buffer_map, NULL);
 
    if (priv->pipe) {
       vl_compositor_cleanup_state(&priv->cstate);
index 70d4bac63a7f9317b935c6bea4c1a60ed223999e..0c596f3f811f3240e60a9ceee1b2ae7819d4c1d2 100644 (file)
@@ -342,12 +342,12 @@ vlVaDestroyContext(VADriverContextP ctx, VAContextID context_id)
          if (u_reduce_video_profile(context->decoder->profile) ==
              PIPE_VIDEO_FORMAT_MPEG4_AVC) {
             if (context->desc.h264enc.frame_idx)
-               util_hash_table_destroy (context->desc.h264enc.frame_idx);
+               _mesa_hash_table_destroy(context->desc.h264enc.frame_idx, NULL);
          }
          if (u_reduce_video_profile(context->decoder->profile) ==
              PIPE_VIDEO_FORMAT_HEVC) {
             if (context->desc.h265enc.frame_idx)
-               util_hash_table_destroy (context->desc.h265enc.frame_idx);
+               _mesa_hash_table_destroy(context->desc.h265enc.frame_idx, NULL);
          }
       } else {
          if (u_reduce_video_profile(context->decoder->profile) ==
index f46b342556691b693d5df8f623bc9277d9a94af3..8ee27d2cb290a1400470dc10aab6391feae07fa0 100644 (file)
@@ -52,7 +52,7 @@ vlVaHandleVAEncPictureParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *cont
                                             PIPE_USAGE_STREAM, coded_buf->size);
    context->coded_buf = coded_buf;
 
-   util_hash_table_set(context->desc.h264enc.frame_idx,
+   _mesa_hash_table_insert(context->desc.h264enc.frame_idx,
                       UINT_TO_PTR(h264->CurrPic.picture_id),
                       UINT_TO_PTR(h264->frame_num));
 
index 8906901b26200f5e8ce2f0d9beeb6f0a9bd372b8..510597753ceefcea7ebfb0efbdd01831d4bf849d 100644 (file)
@@ -73,7 +73,7 @@ vlVaHandleVAEncPictureParameterBufferTypeHEVC(vlVaDriver *drv, vlVaContext *cont
 
    context->desc.h265enc.pic.constrained_intra_pred_flag = h265->pic_fields.bits.constrained_intra_pred_flag;
 
-   util_hash_table_set(context->desc.h265enc.frame_idx,
+   _mesa_hash_table_insert(context->desc.h265enc.frame_idx,
                        UINT_TO_PTR(h265->decoded_curr_pic.picture_id),
                        UINT_TO_PTR(context->desc.h265enc.frame_num));
 
index 18ed3aaa5966892641296cce6da49bc0a6d95658..8a821c8fd4f2420334c2334a06f324d1cb421ffb 100644 (file)
@@ -198,7 +198,7 @@ void amdgpu_bo_destroy(struct pb_buffer *_buf)
    simple_mtx_unlock(&ws->sws_list_lock);
 
    simple_mtx_lock(&ws->bo_export_table_lock);
-   util_hash_table_remove(ws->bo_export_table, bo->bo);
+   _mesa_hash_table_remove_key(ws->bo_export_table, bo->bo);
    simple_mtx_unlock(&ws->bo_export_table_lock);
 
    if (bo->initial_domain & RADEON_DOMAIN_VRAM_GTT) {
@@ -1519,7 +1519,7 @@ static struct pb_buffer *amdgpu_bo_from_handle(struct radeon_winsys *rws,
 
    amdgpu_add_buffer_to_global_list(bo);
 
-   util_hash_table_set(ws->bo_export_table, bo->bo, bo);
+   _mesa_hash_table_insert(ws->bo_export_table, bo->bo, bo);
    simple_mtx_unlock(&ws->bo_export_table_lock);
 
    return &bo->base;
@@ -1602,7 +1602,7 @@ static bool amdgpu_bo_get_handle(struct radeon_winsys *rws,
 
  hash_table_set:
    simple_mtx_lock(&ws->bo_export_table_lock);
-   util_hash_table_set(ws->bo_export_table, bo->bo, bo);
+   _mesa_hash_table_insert(ws->bo_export_table, bo->bo, bo);
    simple_mtx_unlock(&ws->bo_export_table_lock);
 
    bo->is_shared = true;
index f770daafa16dc7b5a286fe9737ccba79a165114d..3dff8e46ada4512b76e53088761eb9343fbbd5ad 100644 (file)
@@ -139,7 +139,7 @@ static void do_winsys_deinit(struct amdgpu_winsys *ws)
          pb_slabs_deinit(&ws->bo_slabs[i]);
    }
    pb_cache_deinit(&ws->bo_cache);
-   util_hash_table_destroy(ws->bo_export_table);
+   _mesa_hash_table_destroy(ws->bo_export_table, NULL);
    simple_mtx_destroy(&ws->sws_list_lock);
    simple_mtx_destroy(&ws->global_bo_list_lock);
    simple_mtx_destroy(&ws->bo_export_table_lock);
@@ -165,9 +165,9 @@ static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
 
    destroy = pipe_reference(&ws->reference, NULL);
    if (destroy && dev_tab) {
-      util_hash_table_remove(dev_tab, ws->dev);
-      if (util_hash_table_count(dev_tab) == 0) {
-         util_hash_table_destroy(dev_tab);
+      _mesa_hash_table_remove_key(dev_tab, ws->dev);
+      if (_mesa_hash_table_num_entries(dev_tab) == 0) {
+         _mesa_hash_table_destroy(dev_tab, NULL);
          dev_tab = NULL;
       }
    }
@@ -467,7 +467,7 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
          return NULL;
       }
 
-      util_hash_table_set(dev_tab, dev, aws);
+      _mesa_hash_table_insert(dev_tab, dev, aws);
 
       if (aws->reserve_vmid) {
          r = amdgpu_vm_reserve_vmid(dev, 0);
index 1d3f6dc817b90443c5d975aea148c58788875ad2..e5e00dd3d64d186d743c2fbcff51c7caf23ae7f1 100644 (file)
@@ -81,7 +81,7 @@ etna_drm_screen_destroy(struct pipe_screen *pscreen)
    destroy = --screen->refcnt == 0;
    if (destroy) {
       int fd = etna_device_fd(screen->dev);
-      util_hash_table_remove(etna_tab, intptr_to_pointer(fd));
+      _mesa_hash_table_remove_key(etna_tab, intptr_to_pointer(fd));
    }
    mtx_unlock(&etna_screen_mutex);
 
@@ -110,7 +110,7 @@ etna_drm_screen_create_renderonly(struct renderonly *ro)
       pscreen = screen_create(ro);
       if (pscreen) {
          int fd = etna_device_fd(etna_screen(pscreen)->dev);
-         util_hash_table_set(etna_tab, intptr_to_pointer(fd), pscreen);
+         _mesa_hash_table_insert(etna_tab, intptr_to_pointer(fd), pscreen);
 
          /* Bit of a hack, to avoid circular linkage dependency,
          * ie. pipe driver having to call in to winsys, we
index c0da444785ff0aaa81cc08aaa7fc88d976e0d82b..6bc4853f08af5f9c65de077a49c554cf2c562636 100644 (file)
@@ -52,7 +52,7 @@ fd_drm_screen_destroy(struct pipe_screen *pscreen)
        destroy = --screen->refcnt == 0;
        if (destroy) {
                int fd = fd_device_fd(screen->dev);
-               util_hash_table_remove(fd_tab, intptr_to_pointer(fd));
+               _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(fd));
        }
        mtx_unlock(&fd_screen_mutex);
 
@@ -86,7 +86,7 @@ fd_drm_screen_create(int fd, struct renderonly *ro)
                if (pscreen) {
                        int fd = fd_device_fd(dev);
 
-                       util_hash_table_set(fd_tab, intptr_to_pointer(fd), pscreen);
+                       _mesa_hash_table_insert(fd_tab, intptr_to_pointer(fd), pscreen);
 
                        /* Bit of a hack, to avoid circular linkage dependency,
                         * ie. pipe driver having to call in to winsys, we
index 6dcd21c2e60b21e5969027cbae9d90af12c333cc..046b47b65e7b37236404400f31ba823b88f9d0bb 100644 (file)
@@ -47,7 +47,7 @@ lima_drm_screen_destroy(struct pipe_screen *pscreen)
    mtx_lock(&lima_screen_mutex);
    destroy = --screen->refcnt == 0;
    if (destroy)
-      util_hash_table_remove(fd_tab, intptr_to_pointer(fd));
+      _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(fd));
    mtx_unlock(&lima_screen_mutex);
 
    if (destroy) {
@@ -77,7 +77,7 @@ lima_drm_screen_create(int fd)
 
       pscreen = lima_screen_create(dup_fd, NULL);
       if (pscreen) {
-         util_hash_table_set(fd_tab, intptr_to_pointer(dup_fd), pscreen);
+         _mesa_hash_table_insert(fd_tab, intptr_to_pointer(dup_fd), pscreen);
 
          /* Bit of a hack, to avoid circular linkage dependency,
           * ie. pipe driver having to call in to winsys, we
index 8547219b6897526d68b21cc854197b446848fc89..313126060bae7b119cf1c7f841e3e0593145fe44 100644 (file)
@@ -31,7 +31,7 @@ bool nouveau_drm_screen_unref(struct nouveau_screen *screen)
        ret = --screen->refcount;
        assert(ret >= 0);
        if (ret == 0)
-               util_hash_table_remove(fd_tab, intptr_to_pointer(screen->drm->fd));
+               _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(screen->drm->fd));
        mtx_unlock(&nouveau_screen_mutex);
        return ret == 0;
 }
@@ -119,7 +119,7 @@ nouveau_drm_screen_create(int fd)
         * closed by its owner. The hash key needs to live at least as long as
         * the screen.
         */
-       util_hash_table_set(fd_tab, intptr_to_pointer(dupfd), screen);
+       _mesa_hash_table_insert(fd_tab, intptr_to_pointer(dupfd), screen);
        screen->refcount = 1;
        mtx_unlock(&nouveau_screen_mutex);
        return &screen->base;
index 6d3e9c9f7522cf5609123ed95501d23fc7187130..0f3a8aa67cde95f41f959f02f9c70bf2a0b2621b 100644 (file)
@@ -361,9 +361,9 @@ void radeon_bo_destroy(struct pb_buffer *_buf)
     memset(&args, 0, sizeof(args));
 
     mtx_lock(&rws->bo_handles_mutex);
-    util_hash_table_remove(rws->bo_handles, (void*)(uintptr_t)bo->handle);
+    _mesa_hash_table_remove_key(rws->bo_handles, (void*)(uintptr_t)bo->handle);
     if (bo->flink_name) {
-        util_hash_table_remove(rws->bo_names,
+        _mesa_hash_table_remove_key(rws->bo_names,
                                (void*)(uintptr_t)bo->flink_name);
     }
     mtx_unlock(&rws->bo_handles_mutex);
@@ -725,7 +725,7 @@ static struct radeon_bo *radeon_create_bo(struct radeon_drm_winsys *rws,
             return radeon_bo(b);
         }
 
-        util_hash_table_set(rws->bo_vas, (void*)(uintptr_t)bo->va, bo);
+        _mesa_hash_table_insert(rws->bo_vas, (void*)(uintptr_t)bo->va, bo);
         mtx_unlock(&rws->bo_handles_mutex);
     }
 
@@ -1042,7 +1042,7 @@ no_slab:
     bo->u.real.use_reusable_pool = use_reusable_pool;
 
     mtx_lock(&ws->bo_handles_mutex);
-    util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
+    _mesa_hash_table_insert(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
     mtx_unlock(&ws->bo_handles_mutex);
 
     return &bo->base;
@@ -1089,7 +1089,7 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws,
     bo->hash = __sync_fetch_and_add(&ws->next_bo_hash, 1);
     (void) mtx_init(&bo->u.real.map_mutex, mtx_plain);
 
-    util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
+    _mesa_hash_table_insert(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
 
     mtx_unlock(&ws->bo_handles_mutex);
 
@@ -1123,7 +1123,7 @@ static struct pb_buffer *radeon_winsys_bo_from_ptr(struct radeon_winsys *rws,
             return b;
         }
 
-        util_hash_table_set(ws->bo_vas, (void*)(uintptr_t)bo->va, bo);
+        _mesa_hash_table_insert(ws->bo_vas, (void*)(uintptr_t)bo->va, bo);
         mtx_unlock(&ws->bo_handles_mutex);
     }
 
@@ -1217,9 +1217,9 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
     (void) mtx_init(&bo->u.real.map_mutex, mtx_plain);
 
     if (bo->flink_name)
-        util_hash_table_set(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo);
+        _mesa_hash_table_insert(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo);
 
-    util_hash_table_set(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
+    _mesa_hash_table_insert(ws->bo_handles, (void*)(uintptr_t)bo->handle, bo);
 
 done:
     mtx_unlock(&ws->bo_handles_mutex);
@@ -1254,7 +1254,7 @@ done:
             return b;
         }
 
-        util_hash_table_set(ws->bo_vas, (void*)(uintptr_t)bo->va, bo);
+        _mesa_hash_table_insert(ws->bo_vas, (void*)(uintptr_t)bo->va, bo);
         mtx_unlock(&ws->bo_handles_mutex);
     }
 
@@ -1299,7 +1299,7 @@ static bool radeon_winsys_bo_get_handle(struct radeon_winsys *rws,
             bo->flink_name = flink.name;
 
             mtx_lock(&ws->bo_handles_mutex);
-            util_hash_table_set(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo);
+            _mesa_hash_table_insert(ws->bo_names, (void*)(uintptr_t)bo->flink_name, bo);
             mtx_unlock(&ws->bo_handles_mutex);
         }
         whandle->handle = bo->flink_name;
index 394ba1f98312b83d3f14f416f561d05ed5b8bcca..fca5be58751647a18d4aa44a0566fe023a0bae4a 100644 (file)
@@ -622,9 +622,9 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws)
         radeon_surface_manager_free(ws->surf_man);
     }
 
-    util_hash_table_destroy(ws->bo_names);
-    util_hash_table_destroy(ws->bo_handles);
-    util_hash_table_destroy(ws->bo_vas);
+    _mesa_hash_table_destroy(ws->bo_names, NULL);
+    _mesa_hash_table_destroy(ws->bo_handles, NULL);
+    _mesa_hash_table_destroy(ws->bo_vas, NULL);
     mtx_destroy(&ws->bo_handles_mutex);
     mtx_destroy(&ws->vm32.mutex);
     mtx_destroy(&ws->vm64.mutex);
@@ -776,9 +776,9 @@ static bool radeon_winsys_unref(struct radeon_winsys *ws)
 
     destroy = pipe_reference(&rws->reference, NULL);
     if (destroy && fd_tab) {
-        util_hash_table_remove(fd_tab, intptr_to_pointer(rws->fd));
-        if (util_hash_table_count(fd_tab) == 0) {
-           util_hash_table_destroy(fd_tab);
+        _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(rws->fd));
+        if (_mesa_hash_table_num_entries(fd_tab) == 0) {
+           _mesa_hash_table_destroy(fd_tab, NULL);
            fd_tab = NULL;
         }
     }
@@ -929,7 +929,7 @@ radeon_drm_winsys_create(int fd, const struct pipe_screen_config *config,
         return NULL;
     }
 
-    util_hash_table_set(fd_tab, intptr_to_pointer(ws->fd), ws);
+    _mesa_hash_table_insert(fd_tab, intptr_to_pointer(ws->fd), ws);
 
     /* We must unlock the mutex once the winsys is fully initialized, so that
      * other threads attempting to create the winsys from the same fd will
index bc6883ee08c6dd33c39dc309c23326cf844377d7..432f9afcd1f95aa300051e75afe68fc0dbfb6687 100644 (file)
@@ -260,7 +260,7 @@ vmw_swc_flush(struct svga_winsys_context *swc,
       vmw_svga_winsys_surface_reference(&isurf->vsurf, NULL);
    }
 
-   util_hash_table_clear(vswc->hash);
+   _mesa_hash_table_clear(vswc->hash, NULL);
    vswc->surface.used = 0;
    vswc->surface.reserved = 0;
 
@@ -504,12 +504,8 @@ vmw_swc_surface_only_relocation(struct svga_winsys_context *swc,
       isrf = &vswc->surface.items[vswc->surface.used + vswc->surface.staged];
       vmw_svga_winsys_surface_reference(&isrf->vsurf, vsurf);
       isrf->referenced = FALSE;
-      /*
-       * Note that a failure here may just fall back to unhashed behavior
-       * and potentially cause unnecessary flushing, so ignore the
-       * return code.
-       */
-      (void) util_hash_table_set(vswc->hash, vsurf, isrf);
+
+      _mesa_hash_table_insert(vswc->hash, vsurf, isrf);
       ++vswc->surface.staged;
 
       vswc->seen_surfaces += vsurf->size;
@@ -600,12 +596,8 @@ vmw_swc_shader_relocation(struct svga_winsys_context *swc,
          ishader = &vswc->shader.items[vswc->shader.used + vswc->shader.staged];
          vmw_svga_winsys_shader_reference(&ishader->vshader, vshader);
          ishader->referenced = FALSE;
-         /*
-          * Note that a failure here may just fall back to unhashed behavior
-          * and potentially cause unnecessary flushing, so ignore the
-          * return code.
-          */
-         (void) util_hash_table_set(vswc->hash, vshader, ishader);
+
+         _mesa_hash_table_insert(vswc->hash, vshader, ishader);
          ++vswc->shader.staged;
       }
 
@@ -682,7 +674,7 @@ vmw_swc_destroy(struct svga_winsys_context *swc)
       vmw_svga_winsys_shader_reference(&ishader->vshader, NULL);
    }
 
-   util_hash_table_destroy(vswc->hash);
+   _mesa_hash_table_destroy(vswc->hash, NULL);
    pb_validate_destroy(vswc->validate);
    vmw_ioctl_context_destroy(vswc->vws, swc->cid);
 #ifdef DEBUG
index cecb932c4c751ccdad6510a74d5a3f33e46cdaac..8b4b89981b20d35f24da01d27fc8c7f3455316ac 100644 (file)
@@ -69,7 +69,7 @@ vmw_winsys_create( int fd )
    struct stat stat_buf;
 
    if (dev_hash == NULL) {
-      dev_hash = util_hash_table_create(vmw_dev_hash, vmw_dev_compare);
+      dev_hash = _mesa_hash_table_create(NULL, vmw_dev_hash, vmw_dev_compare);
       if (dev_hash == NULL)
          return NULL;
    }
@@ -107,14 +107,12 @@ vmw_winsys_create( int fd )
    if (!vmw_winsys_screen_init_svga(vws))
       goto out_no_svga;
 
-   if (util_hash_table_set(dev_hash, &vws->device, vws) != PIPE_OK)
-      goto out_no_hash_insert;
+   _mesa_hash_table_insert(dev_hash, &vws->device, vws);
 
    cnd_init(&vws->cs_cond);
    mtx_init(&vws->cs_mutex, mtx_plain);
 
    return vws;
-out_no_hash_insert:
 out_no_svga:
    vmw_pools_cleanup(vws);
 out_no_pools:
@@ -132,7 +130,7 @@ void
 vmw_winsys_destroy(struct vmw_winsys_screen *vws)
 {
    if (--vws->open_count == 0) {
-      util_hash_table_remove(dev_hash, &vws->device);
+      _mesa_hash_table_remove_key(dev_hash, &vws->device);
       vmw_pools_cleanup(vws);
       vws->fence_ops->destroy(vws->fence_ops);
       vmw_ioctl_cleanup(vws);
index 4d9aa0332f8cd919ad5731c135421b3ffa5867ae..9d8b2f75891d8b069a7acb0854fd596aa18de36f 100644 (file)
@@ -68,10 +68,10 @@ static void virgl_hw_res_destroy(struct virgl_drm_winsys *qdws,
       struct drm_gem_close args;
 
       mtx_lock(&qdws->bo_handles_mutex);
-      util_hash_table_remove(qdws->bo_handles,
+      _mesa_hash_table_remove_key(qdws->bo_handles,
                              (void *)(uintptr_t)res->bo_handle);
       if (res->flink_name)
-         util_hash_table_remove(qdws->bo_names,
+         _mesa_hash_table_remove_key(qdws->bo_names,
                                 (void *)(uintptr_t)res->flink_name);
       mtx_unlock(&qdws->bo_handles_mutex);
       if (res->ptr)
@@ -113,8 +113,8 @@ virgl_drm_winsys_destroy(struct virgl_winsys *qws)
 
    virgl_resource_cache_flush(&qdws->cache);
 
-   util_hash_table_destroy(qdws->bo_handles);
-   util_hash_table_destroy(qdws->bo_names);
+   _mesa_hash_table_destroy(qdws->bo_handles, NULL);
+   _mesa_hash_table_destroy(qdws->bo_names, NULL);
    mtx_destroy(&qdws->bo_handles_mutex);
    mtx_destroy(&qdws->mutex);
 
@@ -387,8 +387,8 @@ virgl_drm_winsys_resource_create_handle(struct virgl_winsys *qws,
    res->num_cs_references = 0;
 
    if (res->flink_name)
-      util_hash_table_set(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res);
-   util_hash_table_set(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res);
+      _mesa_hash_table_insert(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res);
+   _mesa_hash_table_insert(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res);
 
 done:
    mtx_unlock(&qdws->bo_handles_mutex);
@@ -417,7 +417,7 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws,
          res->flink_name = flink.name;
 
          mtx_lock(&qdws->bo_handles_mutex);
-         util_hash_table_set(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res);
+         _mesa_hash_table_insert(qdws->bo_names, (void *)(uintptr_t)res->flink_name, res);
          mtx_unlock(&qdws->bo_handles_mutex);
       }
       whandle->handle = res->flink_name;
@@ -427,7 +427,7 @@ static boolean virgl_drm_winsys_resource_get_handle(struct virgl_winsys *qws,
       if (drmPrimeHandleToFD(qdws->fd, res->bo_handle, DRM_CLOEXEC, (int*)&whandle->handle))
             return FALSE;
       mtx_lock(&qdws->bo_handles_mutex);
-      util_hash_table_set(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res);
+      _mesa_hash_table_insert(qdws->bo_handles, (void *)(uintptr_t)res->bo_handle, res);
       mtx_unlock(&qdws->bo_handles_mutex);
    }
 
@@ -1017,7 +1017,7 @@ virgl_drm_screen_destroy(struct pipe_screen *pscreen)
    destroy = --screen->refcnt == 0;
    if (destroy) {
       int fd = virgl_drm_winsys(screen->vws)->fd;
-      util_hash_table_remove(fd_tab, intptr_to_pointer(fd));
+      _mesa_hash_table_remove_key(fd_tab, intptr_to_pointer(fd));
       close(fd);
    }
    mtx_unlock(&virgl_screen_mutex);
@@ -1055,7 +1055,7 @@ virgl_drm_screen_create(int fd, const struct pipe_screen_config *config)
 
       pscreen = virgl_create_screen(vws, config);
       if (pscreen) {
-         util_hash_table_set(fd_tab, intptr_to_pointer(dup_fd), pscreen);
+         _mesa_hash_table_insert(fd_tab, intptr_to_pointer(dup_fd), pscreen);
 
          /* Bit of a hack, to avoid circular linkage dependency,
           * ie. pipe driver having to call in to winsys, we