[PATCH] drm/i915/selftests: Flush the test object on creation

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 21 17:59:22 UTC 2018


Move the flush from before emitting the gpu_fill request to the object's
creation to avoid forcing a stall on each write. The only stall should
be after all the writes have been queued and we want to read the
results.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/selftests/i915_gem_context.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
index 7d82043aff10..56d3e52c6580 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c
@@ -347,15 +347,12 @@ static int gpu_fill(struct drm_i915_gem_object *obj,
 	if (IS_ERR(vma))
 		return PTR_ERR(vma);
 
-	err = i915_gem_object_set_to_gtt_domain(obj, false);
-	if (err)
-		return err;
-
 	err = i915_vma_pin(vma, 0, 0, PIN_HIGH | PIN_USER);
 	if (err)
 		return err;
 
-	/* Within the GTT the huge objects maps every page onto
+	/*
+	 * Within the GTT the huge objects maps every page onto
 	 * its 1024 real pages (using phys_pfn = dma_pfn % 1024).
 	 * We set the nth dword within the page using the nth
 	 * mapping via the GTT - this should exercise the GTT mapping
@@ -531,11 +528,14 @@ create_test_object(struct i915_gem_context *ctx,
 
 	err = cpu_fill(obj, STACK_MAGIC);
 	if (err) {
-		pr_err("Failed to fill object with cpu, err=%d\n",
-		       err);
+		pr_err("Failed to fill object with cpu, err=%d\n", err);
 		return ERR_PTR(err);
 	}
 
+	err = i915_gem_object_set_to_gtt_domain(obj, false);
+	if (err)
+		return ERR_PTR(err);
+
 	list_add_tail(&obj->st_link, objects);
 	return obj;
 }
-- 
2.19.1



More information about the Intel-gfx-trybot mailing list