panfrost: derive ht

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28056>
This commit is contained in:
Alyssa Rosenzweig
2024-03-07 16:31:58 -04:00
committed by Marge Bot
parent 93879b1920
commit be5c288dbf
3 changed files with 10 additions and 67 deletions
+2 -13
View File
@@ -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);
}
+2 -13
View File
@@ -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);
}
+6 -41
View File
@@ -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;
}