[Intel-gfx] [PATCH] drm/i915: Only discard simple GGTT vma

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 11 17:47:04 UTC 2020


Be careful that we do not discard the irregular information used for
remapping the planes, and when discarding preserve the partial offset so
that the existing users can continue to interpret the old vma correctly.

An underlying issue here is that we opting to discard a vma while it is
in the process of being bound, because at the time it is not known
whether it will be bound suitable for our use. If we didn't discard, we
would then try to unbind it even if it were suitable after serialising
with the binder.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/2012
Fixes: 9bdcaa5e3a2f ("drm/i915: Discard a misplaced GGTT vma")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld at intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 41553e9e57a9..cd5aeeb96ca4 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -938,9 +938,13 @@ discard_ggtt_vma(struct i915_vma *vma, const struct i915_ggtt_view *view)
 {
 	const struct i915_ggtt_view discard = {
 		.type = I915_GGTT_VIEW_PARTIAL,
+		.partial.offset = view->partial.offset,
 	};
 	struct drm_i915_gem_object *obj = vma->obj;
 
+	if (view->type > I915_GGTT_VIEW_PARTIAL)
+		return false;
+
 	spin_lock(&obj->vma.lock);
 	if (i915_vma_compare(vma, vma->vm, &discard)) {
 		struct rb_node *rb, **p;
-- 
2.20.1



More information about the Intel-gfx mailing list