[PATCH 4/4] drm/ttm: replace dma_resv object on deleted BOs
Christian König
ckoenig.leichtzumerken at gmail.com
Mon Nov 11 14:58:32 UTC 2019
When non-imported BOs are resurrected for delayed delete we replace
the dma_resv object to allow for easy reclaiming of the resources.
Signed-off-by: Christian König <christian.koenig at amd.com>
---
drivers/gpu/drm/ttm/ttm_bo.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 570b0e1089b7..550574ff490f 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -599,6 +599,8 @@ static void ttm_bo_release(struct kref *kref)
}
spin_lock(&ttm_bo_glob.lru_lock);
+ if (bo->type != ttm_bo_type_sg)
+ bo->base.resv = &bo->base._resv;
kref_init(&bo->kref);
list_add_tail(&bo->ddestroy, &bdev->ddestroy);
spin_unlock(&ttm_bo_glob.lru_lock);
@@ -725,7 +727,7 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
if (bo->base.resv == ctx->resv) {
dma_resv_assert_held(bo->base.resv);
- if (ctx->flags & TTM_OPT_FLAG_ALLOW_RES_EVICT || bo->deleted)
+ if (ctx->flags & TTM_OPT_FLAG_ALLOW_RES_EVICT)
ret = true;
*locked = false;
if (busy)
--
2.17.1
More information about the amd-gfx
mailing list