[PATCH 6/7] drm/i915: never clear stolen mem

Robert Beckett bob.beckett at collabora.com
Thu Apr 7 12:02:05 UTC 2022


Signed-off-by: Robert Beckett <bob.beckett at collabora.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
index 4b2dc591aaf5..cb4bb13d8da7 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c
@@ -485,8 +485,11 @@ prev_deps(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx,
 }
 
 static bool
-allow_clear(struct drm_i915_gem_object *obj, struct ttm_tt *ttm)
+allow_clear(struct drm_i915_gem_object *obj, struct ttm_tt *ttm, struct ttm_resource *dst_mem)
 {
+	/* never clear stolen */
+	if (dst_mem->mem_type == I915_PL_STOLEN)
+		return false;
 	/* 
 	 * we want to clear user buffers and any kernel buffers
 	 * that specifically request clearing.
@@ -550,7 +553,7 @@ int i915_ttm_move(struct ttm_buffer_object *bo, bool evict,
 		return PTR_ERR(dst_rsgt);
 
 	clear = !i915_ttm_cpu_maps_iomem(bo->resource) && (!ttm || !ttm_tt_is_populated(ttm));
-	if (!clear || allow_clear(obj, ttm)) {
+	if (!clear || allow_clear(obj, ttm, dst_mem)) {
 		struct i915_deps deps;
 
 		i915_deps_init(&deps, GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list