diff --git a/src/asahi/lib/agx_meta.c b/src/asahi/lib/agx_meta.c index b73d2ac0c82..7d842e7a8ca 100644 --- a/src/asahi/lib/agx_meta.c +++ b/src/asahi/lib/agx_meta.c @@ -166,9 +166,16 @@ key_compare(const void *a, const void *b) } void -agx_meta_init(struct agx_meta_cache *cache, struct agx_device *dev, - void *memctx) +agx_meta_init(struct agx_meta_cache *cache, struct agx_device *dev) { agx_pool_init(&cache->pool, dev, AGX_BO_EXEC | AGX_BO_LOW_VA, true); - cache->ht = _mesa_hash_table_create(memctx, key_hash, key_compare); + cache->ht = _mesa_hash_table_create(NULL, key_hash, key_compare); +} + +void +agx_meta_cleanup(struct agx_meta_cache *cache) +{ + agx_pool_cleanup(&cache->pool); + _mesa_hash_table_destroy(cache->ht, NULL); + cache->ht = NULL; } diff --git a/src/asahi/lib/agx_meta.h b/src/asahi/lib/agx_meta.h index a58f611c6c3..8bc84a9ecac 100644 --- a/src/asahi/lib/agx_meta.h +++ b/src/asahi/lib/agx_meta.h @@ -39,7 +39,7 @@ struct agx_meta_shader { struct agx_meta_shader *agx_get_meta_shader(struct agx_meta_cache *cache, struct agx_meta_key *key); -void agx_meta_init(struct agx_meta_cache *cache, struct agx_device *dev, - void *memctx); +void agx_meta_init(struct agx_meta_cache *cache, struct agx_device *dev); +void agx_meta_cleanup(struct agx_meta_cache *cache); #endif diff --git a/src/asahi/lib/pool.c b/src/asahi/lib/pool.c index 6291ea7b293..ba12e183845 100644 --- a/src/asahi/lib/pool.c +++ b/src/asahi/lib/pool.c @@ -53,7 +53,7 @@ agx_pool_init(struct agx_pool *pool, struct agx_device *dev, memset(pool, 0, sizeof(*pool)); pool->dev = dev; pool->create_flags = create_flags; - util_dynarray_init(&pool->bos, dev->memctx); + util_dynarray_init(&pool->bos, NULL); if (prealloc) agx_pool_alloc_backing(pool, POOL_SLAB_SIZE); diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index aea0f18fa54..81087066f74 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -1103,6 +1103,8 @@ agx_destroy_context(struct pipe_context *pctx) util_unreference_framebuffer_state(&ctx->framebuffer); + agx_meta_cleanup(&ctx->meta); + ralloc_free(ctx); } @@ -1167,7 +1169,7 @@ agx_create_context(struct pipe_screen *screen, void *priv, unsigned flags) agx_init_state_functions(pctx); agx_init_query_functions(pctx); - agx_meta_init(&ctx->meta, agx_device(screen), ctx); + agx_meta_init(&ctx->meta, agx_device(screen)); ctx->blitter = util_blitter_create(pctx);