[PATCH 2/8] drm/i915/ttm: don't backup DONTNEED objects

Matthew Auld matthew.auld at intel.com
Thu Jan 26 10:02:08 UTC 2023


We can simply discard the backing storage for these objects. If we try
to backup such an object the backing will anyway be nuked when moving it
(and we likely just perform a pointless backup of an empty object). This
also prevents potential explosions when in a later patch we allow NULL
bo->resource after doing the pipeline-gutting.

Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Christian König <ckoenig.leichtzumerken at gmail.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c
index 7e67742bc65e..09680e993b4b 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c
@@ -66,6 +66,9 @@ static int i915_ttm_backup(struct i915_gem_apply_to_region *apply,
 	if (obj->flags & I915_BO_ALLOC_PM_VOLATILE)
 		return 0;
 
+	if (obj->mm.madv != I915_MADV_WILLNEED)
+		return i915_ttm_purge(obj);
+
 	/*
 	 * It seems that we might have some framebuffers still pinned at this
 	 * stage, but for such objects we might also need to deal with the CCS
-- 
2.39.1



More information about the Intel-gfx-trybot mailing list