panfrost: plug leak of modifier conversion shaders

We were allocating these, but never freeing the actual CSOs here.

Let's wire things up so we delete the data when we destroy the
hash-table. Because we don't have access to the context in that
callback, we can't call the pipe-level function to delete a CSO,
but luckily we don't actually need the context for the
driver-logic. So let's add an internal helper for that.

Fixes: ae3fb3089f ("panfrost: Add infrastructure for internal AFBC compute shaders")
Fixes: f39194cdd3 ("panfrost: support MTK 16L32S detiling")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35336>
This commit is contained in:
Erik Faye-Lund
2025-06-04 11:47:06 +02:00
committed by Marge Bot
parent cc66651fc1
commit fb0a422be2
@@ -504,6 +504,14 @@ panfrost_afbc_context_init(struct panfrost_context *ctx)
void
panfrost_afbc_context_destroy(struct panfrost_context *ctx)
{
hash_table_foreach(ctx->mod_convert_shaders.shaders, he) {
assert(he->data);
struct pan_mod_convert_shader_data *shader = he->data;
ctx->base.delete_compute_state(&ctx->base, shader->afbc_size_cso);
ctx->base.delete_compute_state(&ctx->base, shader->afbc_pack_cso);
ctx->base.delete_compute_state(&ctx->base, shader->mtk_detile_cso);
}
_mesa_hash_table_destroy(ctx->mod_convert_shaders.shaders, NULL);
pthread_mutex_destroy(&ctx->mod_convert_shaders.lock);
}