[Intel-gfx] [PATCH i-g-t v3] tests/gem_ringfill: Add {render, blitter}-forked-1 subtests.

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Fri Jun 26 04:52:34 PDT 2015


Add forking subtests to gem_ringfill. Tests cause consistent GPU
hangs on SKL.

v2: Removed noop parts.
v3:
- Allow executing the tests in order too (Chris Wilson).
- Rename the tests to -forked-1

Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89959
---
 tests/gem_ringfill.c | 91 ++++++++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 34 deletions(-)

diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index 85b01ea..06da1c2 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -55,6 +55,7 @@ struct bo {
 };
 
 static const int width = 512, height = 512;
+int fd;
 
 static void create_bo(drm_intel_bufmgr *bufmgr,
 		      struct bo *b,
@@ -193,9 +194,52 @@ static void blt_copy(struct intel_batchbuffer *batch,
 	intel_batchbuffer_flush(batch);
 }
 
-drm_intel_bufmgr *bufmgr;
-struct intel_batchbuffer *batch;
-int fd;
+static void run_test(int ring, bool interruptible, int nchild) {
+	drm_intel_bufmgr *bufmgr;
+	struct intel_batchbuffer *batch;
+	igt_render_copyfunc_t copy;
+	const char* ring_name;
+
+	bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
+	igt_require(bufmgr);
+	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
+
+	batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
+	igt_require(batch);
+
+	if (ring == I915_EXEC_RENDER) {
+		copy = igt_get_render_copyfunc(batch->devid);
+		ring_name = "render";
+	} else if (ring == I915_EXEC_BLT) {
+		copy = blt_copy;
+		ring_name = "blt";
+	} else {
+		igt_fail_on_f(true, "Unsupported ring.");
+	}
+
+	/* Not all platforms have dedicated render ring. */
+	igt_require(copy);
+
+	if (interruptible) {
+		igt_fork_signal_helper();
+	}
+
+	if (nchild) {
+		igt_fork(child, nchild) {
+			check_ring(bufmgr, batch, ring_name, copy);
+		}
+		igt_waitchildren();
+	} else {
+		check_ring(bufmgr, batch, ring_name, copy);
+	}
+
+	if (interruptible) {
+		igt_stop_signal_helper();
+	}
+
+	intel_batchbuffer_free(batch);
+	drm_intel_bufmgr_destroy(bufmgr);
+}
 
 igt_main
 {
@@ -203,48 +247,27 @@ igt_main
 
 	igt_fixture {
 		fd = drm_open_any();
-
-		bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
-		drm_intel_bufmgr_gem_enable_reuse(bufmgr);
-		batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
 	}
 
 	igt_subtest("blitter")
-		check_ring(bufmgr, batch, "blt", blt_copy);
+		run_test(I915_EXEC_BLT, false, 0);
 
-	/* Strictly only required on architectures with a separate BLT ring,
-	 * but lets stress everybody.
-	 */
-	igt_subtest("render") {
-		igt_render_copyfunc_t copy;
-
-		copy = igt_get_render_copyfunc(batch->devid);
-		igt_require(copy);
+	igt_subtest("render")
+		run_test(I915_EXEC_RENDER, false, 0);
 
-		check_ring(bufmgr, batch, "render", copy);
-	}
-
-	igt_fork_signal_helper();
 	igt_subtest("blitter-interruptible")
-		check_ring(bufmgr, batch, "blt", blt_copy);
+		run_test(I915_EXEC_BLT, true, 0);
 
-	/* Strictly only required on architectures with a separate BLT ring,
-	 * but lets stress everybody.
-	 */
-	igt_subtest("render-interruptible") {
-		igt_render_copyfunc_t copy;
+	igt_subtest("render-interruptible")
+		run_test(I915_EXEC_RENDER, true, 0);
 
-		copy = igt_get_render_copyfunc(batch->devid);
-		igt_require(copy);
+	igt_subtest("blitter-forked-1")
+		run_test(I915_EXEC_BLT, false, 1);
 
-		check_ring(bufmgr, batch, "render", copy);
-	}
-	igt_stop_signal_helper();
+	igt_subtest("render-forked-1")
+		run_test(I915_EXEC_RENDER, false, 1);
 
 	igt_fixture {
-		intel_batchbuffer_free(batch);
-		drm_intel_bufmgr_destroy(bufmgr);
-
 		close(fd);
 	}
 }
-- 
1.8.5.5





More information about the Intel-gfx mailing list