[PATCH 27/27] drm/i915: Fix ggtt failing on execbuf without pins

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Fri Oct 8 10:22:21 UTC 2021


Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 5bcf71d398aa..c90859679199 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -583,6 +583,15 @@ eb_add_vma(struct i915_execbuffer *eb,
 		if (eb->reloc_cache.has_fence)
 			ev->flags |= EXEC_OBJECT_NEEDS_FENCE;
 
+		/*
+		 * When pinning the batch buffer into ggtt, we may need to
+		 * update relocations. Put the batch inside mappable area,
+		 * because reloc_iomap() will unbind the batch buffer
+		 * otherwise, as we no longer pin buffers inside execbuf.
+		 */
+		if (i915_is_ggtt(vma->vm) && entry->relocation_count)
+			ev->flags |= __EXEC_OBJECT_NEEDS_MAP;
+
 		eb->batch = ev;
 	}
 }
-- 
2.33.0



More information about the Intel-gfx-trybot mailing list