/* 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);
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
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 */