diff --git a/src/gallium/drivers/panfrost/pan_afbc_cso.c b/src/gallium/drivers/panfrost/pan_afbc_cso.c index 931069cbb50..8ed0a7d8c84 100644 --- a/src/gallium/drivers/panfrost/pan_afbc_cso.c +++ b/src/gallium/drivers/panfrost/pan_afbc_cso.c @@ -306,23 +306,12 @@ panfrost_afbc_get_shaders(struct panfrost_context *ctx, return shader; } -static uint32_t -panfrost_afbc_shader_key_hash(const void *key) -{ - return _mesa_hash_data(key, sizeof(struct pan_afbc_shader_key)); -} - -static bool -panfrost_afbc_shader_key_equal(const void *a, const void *b) -{ - return !memcmp(a, b, sizeof(struct pan_afbc_shader_key)); -} +DERIVE_HASH_TABLE(pan_afbc_shader_key); void panfrost_afbc_context_init(struct panfrost_context *ctx) { - ctx->afbc_shaders.shaders = _mesa_hash_table_create( - NULL, panfrost_afbc_shader_key_hash, panfrost_afbc_shader_key_equal); + ctx->afbc_shaders.shaders = pan_afbc_shader_key_table_create(NULL); pthread_mutex_init(&ctx->afbc_shaders.lock, NULL); } diff --git a/src/panfrost/lib/pan_blend.c b/src/panfrost/lib/pan_blend.c index 902467acbbd..794c6de09af 100644 --- a/src/panfrost/lib/pan_blend.c +++ b/src/panfrost/lib/pan_blend.c @@ -469,25 +469,14 @@ pan_pack_blend(const struct pan_blend_equation equation) return out; } -static uint32_t -pan_blend_shader_key_hash(const void *key) -{ - return _mesa_hash_data(key, sizeof(struct pan_blend_shader_key)); -} - -static bool -pan_blend_shader_key_equal(const void *a, const void *b) -{ - return !memcmp(a, b, sizeof(struct pan_blend_shader_key)); -} +DERIVE_HASH_TABLE(pan_blend_shader_key); void pan_blend_shader_cache_init(struct pan_blend_shader_cache *cache, unsigned gpu_id) { cache->gpu_id = gpu_id; - cache->shaders = _mesa_hash_table_create(NULL, pan_blend_shader_key_hash, - pan_blend_shader_key_equal); + cache->shaders = pan_blend_shader_key_table_create(NULL); pthread_mutex_init(&cache->lock, NULL); } diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c index 0f7724b4b39..b8c885b3edb 100644 --- a/src/panfrost/lib/pan_blitter.c +++ b/src/panfrost/lib/pan_blitter.c @@ -1647,41 +1647,9 @@ GENX(pan_blit)(struct pan_blit_context *ctx, struct pan_pool *pool, } #endif -static uint32_t -pan_blit_shader_key_hash(const void *key) -{ - return _mesa_hash_data(key, sizeof(struct pan_blit_shader_key)); -} - -static bool -pan_blit_shader_key_equal(const void *a, const void *b) -{ - return !memcmp(a, b, sizeof(struct pan_blit_shader_key)); -} - -static uint32_t -pan_blit_blend_shader_key_hash(const void *key) -{ - return _mesa_hash_data(key, sizeof(struct pan_blit_blend_shader_key)); -} - -static bool -pan_blit_blend_shader_key_equal(const void *a, const void *b) -{ - return !memcmp(a, b, sizeof(struct pan_blit_blend_shader_key)); -} - -static uint32_t -pan_blit_rsd_key_hash(const void *key) -{ - return _mesa_hash_data(key, sizeof(struct pan_blit_rsd_key)); -} - -static bool -pan_blit_rsd_key_equal(const void *a, const void *b) -{ - return !memcmp(a, b, sizeof(struct pan_blit_rsd_key)); -} +DERIVE_HASH_TABLE(pan_blit_shader_key); +DERIVE_HASH_TABLE(pan_blit_blend_shader_key); +DERIVE_HASH_TABLE(pan_blit_rsd_key); static void pan_blitter_prefill_blit_shader_cache(struct pan_blitter_cache *cache) @@ -1731,17 +1699,14 @@ GENX(pan_blitter_cache_init)(struct pan_blitter_cache *cache, struct pan_pool *desc_pool) { cache->gpu_id = gpu_id; - cache->shaders.blit = _mesa_hash_table_create(NULL, pan_blit_shader_key_hash, - pan_blit_shader_key_equal); - cache->shaders.blend = _mesa_hash_table_create( - NULL, pan_blit_blend_shader_key_hash, pan_blit_blend_shader_key_equal); + cache->shaders.blit = pan_blit_shader_key_table_create(NULL); + cache->shaders.blend = pan_blit_blend_shader_key_table_create(NULL); cache->shaders.pool = bin_pool; pthread_mutex_init(&cache->shaders.lock, NULL); pan_blitter_prefill_blit_shader_cache(cache); cache->rsds.pool = desc_pool; - cache->rsds.rsds = _mesa_hash_table_create(NULL, pan_blit_rsd_key_hash, - pan_blit_rsd_key_equal); + cache->rsds.rsds = pan_blit_rsd_key_table_create(NULL); pthread_mutex_init(&cache->rsds.lock, NULL); cache->blend_shader_cache = blend_shader_cache; }