mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-20 02:20:22 +01:00
freedreno/drm: Invert BO destruction
Sub-alloc'd heap BOs will need to do something a bit more special, ie. not immediately cleanup fences (because those will be needed to know when the BO is actually idle and vma node can be released), not tear down the mmap (because the BO doesn't own it), and not close the handle (also because the BO doesn't own it). Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
This commit is contained in:
parent
84f44137ff
commit
fd20df8f09
4 changed files with 20 additions and 4 deletions
|
|
@ -354,10 +354,15 @@ fd_bo_del_list_nocache(struct list_head *list)
|
|||
}
|
||||
|
||||
/**
|
||||
* The returned handle must be closed via a call to close_handles()
|
||||
* Helper called by backends bo->funcs->destroy()
|
||||
*
|
||||
* Called under table_lock, bo_del_flush() *must* be called before
|
||||
* table_lock is released (but bo->funcs->destroy() can be called
|
||||
* multiple times before bo_del_flush(), as long as table_lock is
|
||||
* held the entire time)
|
||||
*/
|
||||
static uint32_t
|
||||
bo_del(struct fd_bo *bo)
|
||||
void
|
||||
fd_bo_fini_common(struct fd_bo *bo)
|
||||
{
|
||||
struct fd_device *dev = bo->dev;
|
||||
uint32_t handle = bo->handle;
|
||||
|
|
@ -380,9 +385,16 @@ bo_del(struct fd_bo *bo)
|
|||
_mesa_hash_table_remove_key(dev->name_table, &bo->name);
|
||||
simple_mtx_unlock(&table_lock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The returned handle must be closed via a call to close_handles()
|
||||
*/
|
||||
static uint32_t
|
||||
bo_del(struct fd_bo *bo)
|
||||
{
|
||||
uint32_t handle = bo->handle;
|
||||
bo->funcs->destroy(bo);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -351,6 +351,7 @@ enum fd_bo_state {
|
|||
enum fd_bo_state fd_bo_state(struct fd_bo *bo);
|
||||
|
||||
void fd_bo_init_common(struct fd_bo *bo, struct fd_device *dev);
|
||||
void fd_bo_fini_common(struct fd_bo *bo);
|
||||
|
||||
struct fd_bo *fd_bo_new_ring(struct fd_device *dev, uint32_t size);
|
||||
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ static void
|
|||
msm_bo_destroy(struct fd_bo *bo)
|
||||
{
|
||||
struct msm_bo *msm_bo = to_msm_bo(bo);
|
||||
fd_bo_fini_common(bo);
|
||||
free(msm_bo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -276,6 +276,8 @@ virtio_bo_destroy(struct fd_bo *bo)
|
|||
virtio_dev_free_iova(bo->dev, bo->iova, bo->size);
|
||||
}
|
||||
|
||||
fd_bo_fini_common(bo);
|
||||
|
||||
free(virtio_bo);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue