[Intel-gfx] [RFC] tests/gem_reset_stats: add subtest hang-render-and-<ring>

Mika Kuoppala mika.kuoppala at linux.intel.com
Tue Jan 28 12:16:35 CET 2014


If multiple rings are hung at the same time by two different
contexts, both should get get blamed for hanging the GPU.

Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
 tests/gem_reset_stats.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index 331d954..c1bf72e 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -1017,6 +1017,37 @@ static void test_params(void)
 	close(fd);
 }
 
+static void test_hang_render_and(void)
+{
+	int fd[2];
+	int h[2];
+	int ctx;
+	const struct target_ring *ring = current_ring;
+
+	fd[0] = drm_open_any();
+	fd[1] = drm_open_any();
+
+	ctx = context_create(fd[0]);
+	igt_assert(ctx >= 0);
+
+	h[0] = inject_hang_ring(fd[0], ctx, I915_EXEC_RENDER);
+	h[1] = inject_hang_ring(fd[1], 0, ring->exec);
+
+	gem_sync(fd[1], h[1]);
+
+	assert_reset_status(fd[0], ctx, RS_BATCH_ACTIVE);
+	assert_reset_status(fd[1], 0, RS_BATCH_ACTIVE);
+
+	gem_close(fd[1], h[1]);
+	gem_close(fd[0], h[0]);
+
+	context_destroy(fd[0], ctx);
+
+	close(fd[1]);
+	close(fd[0]);
+}
+
+
 #define RING_HAS_CONTEXTS current_ring->contexts(current_ring)
 #define RUN_CTX_TEST(...) do { igt_skip_on(RING_HAS_CONTEXTS == false); __VA_ARGS__; } while (0)
 
@@ -1093,5 +1124,8 @@ igt_main
 			test_close_pending_fork(true);
 			test_close_pending_fork(false);
 		}
+
+		igt_subtest_f("hang-render-and-%s", name)
+			test_hang_render_and();
 	}
 }
-- 
1.7.9.5




More information about the Intel-gfx mailing list