util/hash_table: update users to use new optimal integer hash functions

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3475>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3475>
This commit is contained in:
Anthony Pesch
2020-01-16 09:11:16 -05:00
committed by Marge Bot
parent 1496cc92f6
commit f77369086c
6 changed files with 10 additions and 83 deletions

View File

@@ -33,18 +33,6 @@ struct partial_update_state {
uint8_t channels;
};
static uint32_t
int_hash(const void *key)
{
return _mesa_hash_data(key, sizeof(int));
}
static bool
int_compare(const void *key1, const void *key2)
{
return *(const int *)key1 == *(const int *)key2;
}
static int
vir_reg_to_var(struct qreg reg)
{
@@ -197,7 +185,7 @@ static void
vir_setup_def_use(struct v3d_compile *c)
{
struct hash_table *partial_update_ht =
_mesa_hash_table_create(c, int_hash, int_compare);
_mesa_hash_table_create(c, _mesa_hash_int, _mesa_key_int_equal);
int ip = 0;
vir_for_each_block(block, c) {

View File

@@ -31,18 +31,6 @@
static pthread_mutex_t etna_drm_table_lock = PTHREAD_MUTEX_INITIALIZER;
static uint32_t
u32_hash(const void *key)
{
return _mesa_hash_data(key, sizeof(uint32_t));
}
static bool
u32_equals(const void *key1, const void *key2)
{
return *(const uint32_t *)key1 == *(const uint32_t *)key2;
}
struct etna_device *etna_device_new(int fd)
{
struct etna_device *dev = calloc(sizeof(*dev), 1);
@@ -56,8 +44,8 @@ struct etna_device *etna_device_new(int fd)
p_atomic_set(&dev->refcnt, 1);
dev->fd = fd;
dev->handle_table = _mesa_hash_table_create(NULL, u32_hash, u32_equals);
dev->name_table = _mesa_hash_table_create(NULL, u32_hash, u32_equals);
dev->handle_table = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal);
dev->name_table = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal);
etna_bo_cache_init(&dev->bo_cache);
ret = drmCommandWriteRead(dev->fd, DRM_ETNAVIV_GET_PARAM, &req, sizeof(req));

View File

@@ -33,19 +33,6 @@
static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER;
static uint32_t
u32_hash(const void *key)
{
return _mesa_hash_data(key, sizeof(uint32_t));
}
static bool
u32_equals(const void *key1, const void *key2)
{
return *(const uint32_t *)key1 == *(const uint32_t *)key2;
}
struct fd_device * kgsl_device_new(int fd);
struct fd_device * msm_device_new(int fd);
@@ -90,8 +77,8 @@ out:
p_atomic_set(&dev->refcnt, 1);
dev->fd = fd;
dev->handle_table = _mesa_hash_table_create(NULL, u32_hash, u32_equals);
dev->name_table = _mesa_hash_table_create(NULL, u32_hash, u32_equals);
dev->handle_table = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal);
dev->name_table = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal);
fd_bo_cache_init(&dev->bo_cache, FALSE);
fd_bo_cache_init(&dev->ring_cache, TRUE);

View File

@@ -160,18 +160,6 @@ static uint64_t vma_alloc(struct iris_bufmgr *bufmgr,
enum iris_memory_zone memzone,
uint64_t size, uint64_t alignment);
static uint32_t
key_hash_uint(const void *key)
{
return _mesa_hash_data(key, 4);
}
static bool
key_uint_equal(const void *a, const void *b)
{
return *((unsigned *) a) == *((unsigned *) b);
}
static struct iris_bo *
find_and_ref_external_bo(struct hash_table *ht, unsigned int key)
{
@@ -1698,9 +1686,9 @@ iris_bufmgr_init(struct gen_device_info *devinfo, int fd, bool bo_reuse)
init_cache_buckets(bufmgr);
bufmgr->name_table =
_mesa_hash_table_create(NULL, key_hash_uint, key_uint_equal);
_mesa_hash_table_create(NULL, _mesa_hash_uint, _mesa_key_uint_equal);
bufmgr->handle_table =
_mesa_hash_table_create(NULL, key_hash_uint, key_uint_equal);
_mesa_hash_table_create(NULL, _mesa_hash_uint, _mesa_key_uint_equal);
if (devinfo->gen >= 12) {
bufmgr->aux_map_ctx = gen_aux_map_init(bufmgr, &aux_map_allocator,

View File

@@ -34,18 +34,6 @@ struct partial_update_state {
uint8_t channels;
};
static uint32_t
int_hash(const void *key)
{
return _mesa_hash_data(key, sizeof(int));
}
static bool
int_compare(const void *key1, const void *key2)
{
return *(const int *)key1 == *(const int *)key2;
}
static int
qir_reg_to_var(struct qreg reg)
{
@@ -194,7 +182,7 @@ static void
qir_setup_def_use(struct vc4_compile *c)
{
struct hash_table *partial_update_ht =
_mesa_hash_table_create(c, int_hash, int_compare);
_mesa_hash_table_create(c, _mesa_hash_int, _mesa_key_int_equal);
int ip = 0;
qir_for_each_block(block, c) {

View File

@@ -166,18 +166,6 @@ static uint64_t vma_alloc(struct brw_bufmgr *bufmgr,
enum brw_memory_zone memzone,
uint64_t size, uint64_t alignment);
static uint32_t
key_hash_uint(const void *key)
{
return _mesa_hash_data(key, 4);
}
static bool
key_uint_equal(const void *a, const void *b)
{
return *((unsigned *) a) == *((unsigned *) b);
}
static struct brw_bo *
hash_find_bo(struct hash_table *ht, unsigned int key)
{
@@ -1739,9 +1727,9 @@ brw_bufmgr_init(struct gen_device_info *devinfo, int fd, bool bo_reuse)
init_cache_buckets(bufmgr);
bufmgr->name_table =
_mesa_hash_table_create(NULL, key_hash_uint, key_uint_equal);
_mesa_hash_table_create(NULL, _mesa_hash_uint, _mesa_key_uint_equal);
bufmgr->handle_table =
_mesa_hash_table_create(NULL, key_hash_uint, key_uint_equal);
_mesa_hash_table_create(NULL, _mesa_hash_uint, _mesa_key_uint_equal);
return bufmgr;
}