[PATCH 16/26] drm/i915: Ensure gem_contexts selftests work with unbind changes.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Wed Sep 29 07:52:14 UTC 2021


In the next commit, we don't evict when refcount = 0, so we need to
call drain freed objects, because we want to pin new bo's in the same
place, causing a test failure.

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

diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
index b32f7fed2d9c..4dacb1e87df4 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
@@ -1570,7 +1570,11 @@ static int write_to_scratch(struct i915_gem_context *ctx,
 out_vm:
 	i915_vm_put(vm);
 out:
+	if (!err)
+		err = i915_gem_object_wait(obj, 0, MAX_SCHEDULE_TIMEOUT);
+
 	i915_gem_object_put(obj);
+	i915_gem_drain_freed_objects(i915);
 	return err;
 }
 
@@ -1723,7 +1727,11 @@ static int read_from_scratch(struct i915_gem_context *ctx,
 out_vm:
 	i915_vm_put(vm);
 out:
+	if (!err)
+		err = i915_gem_object_wait(obj, 0, MAX_SCHEDULE_TIMEOUT);
+
 	i915_gem_object_put(obj);
+	i915_gem_drain_freed_objects(i915);
 	return err;
 }
 
-- 
2.33.0



More information about the Intel-gfx-trybot mailing list