From e7b3dcb9f7112fe9f9ec8a377ead1f0735830e07 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 29 Nov 2024 09:58:14 -0500 Subject: [PATCH] asahi: label individual pools Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/agx_bg_eot.c | 3 ++- src/asahi/lib/pool.c | 5 +++-- src/asahi/lib/pool.h | 5 ++++- src/gallium/drivers/asahi/agx_batch.c | 5 +++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/asahi/lib/agx_bg_eot.c b/src/asahi/lib/agx_bg_eot.c index b9057758484..9d82007ab40 100644 --- a/src/asahi/lib/agx_bg_eot.c +++ b/src/asahi/lib/agx_bg_eot.c @@ -217,7 +217,8 @@ DERIVE_HASH_TABLE(agx_bg_eot_key); void agx_bg_eot_init(struct agx_bg_eot_cache *cache, struct agx_device *dev) { - agx_pool_init(&cache->pool, dev, AGX_BO_EXEC | AGX_BO_LOW_VA, true); + agx_pool_init(&cache->pool, dev, "Internal programs", + AGX_BO_EXEC | AGX_BO_LOW_VA, true); simple_mtx_init(&cache->lock, mtx_plain); cache->ht = agx_bg_eot_key_table_create(NULL); cache->dev = dev; diff --git a/src/asahi/lib/pool.c b/src/asahi/lib/pool.c index 85c1b265a29..542b21f4dfb 100644 --- a/src/asahi/lib/pool.c +++ b/src/asahi/lib/pool.c @@ -19,7 +19,7 @@ static struct agx_bo * agx_pool_alloc_backing(struct agx_pool *pool, size_t bo_sz) { struct agx_bo *bo = - agx_bo_create(pool->dev, bo_sz, 0, pool->create_flags, "Pool"); + agx_bo_create(pool->dev, bo_sz, 0, pool->create_flags, pool->label); util_dynarray_append(&pool->bos, struct agx_bo *, bo); pool->transient_bo = bo; @@ -29,12 +29,13 @@ agx_pool_alloc_backing(struct agx_pool *pool, size_t bo_sz) } void -agx_pool_init(struct agx_pool *pool, struct agx_device *dev, +agx_pool_init(struct agx_pool *pool, struct agx_device *dev, const char *label, unsigned create_flags, bool prealloc) { memset(pool, 0, sizeof(*pool)); pool->dev = dev; pool->create_flags = create_flags; + pool->label = label; util_dynarray_init(&pool->bos, NULL); if (prealloc) diff --git a/src/asahi/lib/pool.h b/src/asahi/lib/pool.h index 4906e8b93b8..eab4c0ddd41 100644 --- a/src/asahi/lib/pool.h +++ b/src/asahi/lib/pool.h @@ -31,10 +31,13 @@ struct agx_pool { /* BO flags to use in the pool */ unsigned create_flags; + + /* Label for pool allocations */ + const char *label; }; void agx_pool_init(struct agx_pool *pool, struct agx_device *dev, - unsigned create_flags, bool prealloc); + const char *label, unsigned create_flags, bool prealloc); void agx_pool_cleanup(struct agx_pool *pool); diff --git a/src/gallium/drivers/asahi/agx_batch.c b/src/gallium/drivers/asahi/agx_batch.c index a8ab13dad74..4a334f9a6f9 100644 --- a/src/gallium/drivers/asahi/agx_batch.c +++ b/src/gallium/drivers/asahi/agx_batch.c @@ -101,8 +101,9 @@ agx_batch_init(struct agx_context *ctx, batch->seqnum = ++ctx->batches.seqnum; agx_bo_reference(screen->rodata); - agx_pool_init(&batch->pool, dev, 0, true); - agx_pool_init(&batch->pipeline_pool, dev, AGX_BO_LOW_VA, true); + agx_pool_init(&batch->pool, dev, "Batch pool", 0, true); + agx_pool_init(&batch->pipeline_pool, dev, "Batch low VA pool", AGX_BO_LOW_VA, + true); /* These allocations can happen only once and will just be zeroed (not freed) * during batch clean up. The memory is owned by the context.