turnip: Track refcounts on BOs in kgsl as well.

I'm going to be using the BO refcount for the pipeline and autotune buffer
suballocation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15038>
This commit is contained in:
Emma Anholt 2022-04-06 13:05:40 -07:00 committed by Marge Bot
parent e858da39e5
commit 80c44a6626
2 changed files with 6 additions and 1 deletions

View file

@ -109,6 +109,7 @@ tu_bo_init_new(struct tu_device *dev, struct tu_bo **out_bo, uint64_t size,
.gem_handle = req.id,
.size = req.mmapsize,
.iova = req.gpuaddr,
.refcnt = 1,
};
*out_bo = bo;
@ -156,6 +157,7 @@ tu_bo_init_dmabuf(struct tu_device *dev,
.gem_handle = req.id,
.size = info_req.size,
.iova = info_req.gpuaddr,
.refcnt = 1,
};
*out_bo = bo;
@ -193,6 +195,9 @@ tu_bo_finish(struct tu_device *dev, struct tu_bo *bo)
{
assert(bo->gem_handle);
if (!p_atomic_dec_zero(&bo->refcnt))
return;
if (bo->map)
munmap(bo->map, bo->size);

View file

@ -370,9 +370,9 @@ struct tu_bo
uint64_t size;
uint64_t iova;
void *map;
int32_t refcnt;
#ifndef TU_USE_KGSL
int32_t refcnt;
uint32_t bo_list_idx;
#endif