Mesa (master): panfrost: Rename panfrost_create_pool() into panfrost_pool_init()
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 28 20:31:23 UTC 2020
Module: Mesa
Branch: master
Commit: 4047c691bff192fdcac20a16fb9a4f4071de4af9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4047c691bff192fdcac20a16fb9a4f4071de4af9
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Mon Aug 24 11:24:57 2020 +0200
panfrost: Rename panfrost_create_pool() into panfrost_pool_init()
_create functions usually allocate an object and return a pointer to the
allocated object, _init ones usually take an existing object and
initialize it. Let's follow this semantic here by renaming the
panfrost_create_pool() function and updating its prototype.
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6494>
---
src/gallium/drivers/panfrost/pan_job.c | 5 ++---
src/panfrost/lib/pan_pool.c | 23 +++++++++--------------
src/panfrost/lib/pan_pool.h | 6 ++++--
3 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 6c04b21a643..43aee264b3c 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -115,13 +115,12 @@ panfrost_create_batch(struct panfrost_context *ctx,
/* Preallocate the main pool, since every batch has at least one job
* structure so it will be used */
- batch->pool = panfrost_create_pool(batch, dev, 0, true);
+ panfrost_pool_init(&batch->pool, batch, dev, 0, true);
/* Don't preallocate the invisible pool, since not every batch will use
* the pre-allocation, particularly if the varyings are larger than the
* preallocation and a reallocation is needed after anyway. */
- batch->invisible_pool =
- panfrost_create_pool(batch, dev, PAN_BO_INVISIBLE, false);
+ panfrost_pool_init(&batch->invisible_pool, batch, dev, PAN_BO_INVISIBLE, false);
panfrost_batch_add_fbo_bos(batch);
diff --git a/src/panfrost/lib/pan_pool.c b/src/panfrost/lib/pan_pool.c
index 87bb821a748..5fc7cc041f6 100644
--- a/src/panfrost/lib/pan_pool.c
+++ b/src/panfrost/lib/pan_pool.c
@@ -56,24 +56,19 @@ panfrost_pool_alloc_backing(struct pan_pool *pool, size_t bo_sz)
return bo;
}
-struct pan_pool
-panfrost_create_pool(void *memctx, struct panfrost_device *dev,
- unsigned create_flags, bool prealloc)
+void
+panfrost_pool_init(struct pan_pool *pool, void *memctx,
+ struct panfrost_device *dev,
+ unsigned create_flags, bool prealloc)
{
- struct pan_pool pool = {
- .dev = dev,
- .create_flags = create_flags,
- .transient_offset = 0,
- .transient_bo = NULL
- };
-
- pool.bos = _mesa_hash_table_create(memctx, _mesa_hash_pointer,
+ memset(pool, 0, sizeof(*pool));
+ pool->dev = dev;
+ pool->create_flags = create_flags;
+ pool->bos = _mesa_hash_table_create(memctx, _mesa_hash_pointer,
_mesa_key_pointer_equal);
if (prealloc)
- panfrost_pool_alloc_backing(&pool, TRANSIENT_SLAB_SIZE);
-
- return pool;
+ panfrost_pool_alloc_backing(pool, TRANSIENT_SLAB_SIZE);
}
struct panfrost_transfer
diff --git a/src/panfrost/lib/pan_pool.h b/src/panfrost/lib/pan_pool.h
index c35f957e494..23dba284425 100644
--- a/src/panfrost/lib/pan_pool.h
+++ b/src/panfrost/lib/pan_pool.h
@@ -50,8 +50,10 @@ struct pan_pool {
unsigned create_flags;
};
-struct pan_pool
-panfrost_create_pool(void *memctx, struct panfrost_device *dev, unsigned create_flags, bool prealloc);
+void
+panfrost_pool_init(struct pan_pool *pool, void *memctx,
+ struct panfrost_device *dev, unsigned create_flags,
+ bool prealloc);
/* Represents a fat pointer for GPU-mapped memory, returned from the transient
* allocator and not used for much else */
More information about the mesa-commit
mailing list