panfrost: Rename panfrost_create_pool() into panfrost_pool_init()
authorBoris Brezillon <boris.brezillon@collabora.com>
Mon, 24 Aug 2020 09:24:57 +0000 (11:24 +0200)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Aug 2020 19:18:08 +0000 (19:18 +0000)
_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@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6494>

src/gallium/drivers/panfrost/pan_job.c
src/panfrost/lib/pan_pool.c
src/panfrost/lib/pan_pool.h

index 6c04b21a643012b5f5fd12c03e7057fb22c99456..43aee264b3c394d99eb8abffe719ba2382f4ff3f 100644 (file)
@@ -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);
 
index 87bb821a748f30dca3ffc7ee6dfc6eedeeb89e13..5fc7cc041f649b7e8f72bf1916055d463ba85dc5 100644 (file)
@@ -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
index c35f957e494a34af919b0abd18fa93c7aa17033d..23dba284425d7884336b8c8db1a36820d95f4198 100644 (file)
@@ -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 */