panvk: Fix a BO leak in panvk_pool_alloc_backing()
When picking a BO from a BO pool, we need to add it to the memory pool otherwise it gets lost when the memory pool is reset/destroyed. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12762>
This commit is contained in:
@@ -43,20 +43,23 @@
|
||||
static struct panfrost_bo *
|
||||
panvk_pool_alloc_backing(struct panvk_pool *pool, size_t bo_sz)
|
||||
{
|
||||
struct panfrost_bo *bo;
|
||||
|
||||
/* If there's a free BO in our BO pool, let's pick it. */
|
||||
if (pool->bo_pool &&
|
||||
util_dynarray_num_elements(&pool->bo_pool->free_bos, struct panfrost_bo *))
|
||||
return util_dynarray_pop(&pool->bo_pool->free_bos, struct panfrost_bo *);
|
||||
|
||||
/* We don't know what the BO will be used for, so let's flag it
|
||||
* RW and attach it to both the fragment and vertex/tiler jobs.
|
||||
* TODO: if we want fine grained BO assignment we should pass
|
||||
* flags to this function and keep the read/write,
|
||||
* fragment/vertex+tiler pools separate.
|
||||
*/
|
||||
struct panfrost_bo *bo = panfrost_bo_create(pool->base.dev, bo_sz,
|
||||
pool->base.create_flags,
|
||||
pool->base.label);
|
||||
util_dynarray_num_elements(&pool->bo_pool->free_bos, struct panfrost_bo *)) {
|
||||
bo = util_dynarray_pop(&pool->bo_pool->free_bos, struct panfrost_bo *);
|
||||
} else {
|
||||
/* We don't know what the BO will be used for, so let's flag it
|
||||
* RW and attach it to both the fragment and vertex/tiler jobs.
|
||||
* TODO: if we want fine grained BO assignment we should pass
|
||||
* flags to this function and keep the read/write,
|
||||
* fragment/vertex+tiler pools separate.
|
||||
*/
|
||||
bo = panfrost_bo_create(pool->base.dev, bo_sz,
|
||||
pool->base.create_flags,
|
||||
pool->base.label);
|
||||
}
|
||||
|
||||
util_dynarray_append(&pool->bos, struct panfrost_bo *, bo);
|
||||
pool->transient_bo = bo;
|
||||
|
||||
Reference in New Issue
Block a user