mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 11:20:11 +01:00
tu/drm: msm's has_set_iova codepath should avoid freeing zombified tu_sparse_vma
In msm backend's has_set_iova codepath, mapping a BO into a lazy VMA will
require moving that VMA into the zombie VMA mechanism once the BO is
destroyed. That means tu_sparse_vma destruction should avoid freeing VMA if
BO was mapped into it and then zombified.
Signed-off-by: Zan Dobersek <zdobersek@igalia.com>
Fixes: 764b3d9161 ("tu: Implement transient attachments and lazily allocated memory")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37413>
This commit is contained in:
parent
64fc91bb58
commit
d3cedd2fa5
2 changed files with 10 additions and 2 deletions
|
|
@ -102,6 +102,7 @@ struct tu_sparse_vma {
|
|||
struct {
|
||||
uint64_t iova;
|
||||
uint64_t size;
|
||||
bool backs_lazy_bo;
|
||||
} msm;
|
||||
struct {
|
||||
struct tu_bo *virtual_bo;
|
||||
|
|
|
|||
|
|
@ -890,7 +890,10 @@ msm_bo_init(struct tu_device *dev,
|
|||
TU_RMV(internal_resource_create, dev, bo);
|
||||
TU_RMV(resource_name, dev, bo, name);
|
||||
}
|
||||
bo->lazy = !!lazy_vma;
|
||||
if (lazy_vma) {
|
||||
lazy_vma->msm.backs_lazy_bo = true;
|
||||
bo->lazy = true;
|
||||
}
|
||||
} else {
|
||||
if (!lazy_vma)
|
||||
tu_free_iova(dev, iova, size);
|
||||
|
|
@ -1155,7 +1158,11 @@ msm_sparse_vma_finish(struct tu_device *dev,
|
|||
vma->msm.size);
|
||||
}
|
||||
|
||||
tu_free_iova(dev, vma->msm.iova, vma->msm.size);
|
||||
/* For has_set_iova, if a lazy BO was mapped into this sparse VMA
|
||||
* the allocation will be handed off to the zombie VMA mechanism.
|
||||
*/
|
||||
if (dev->physical_device->has_vm_bind || !vma->msm.backs_lazy_bo)
|
||||
tu_free_iova(dev, vma->msm.iova, vma->msm.size);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue