[Intel-gfx] [PATCH i-g-t 2/7] tests/kms_flip: Move kms_flip.vblank-vs-hang to kms_vblank

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Jan 4 13:15:04 UTC 2018


There's no need to test this more than once.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_flip.c   | 10 +---------
 tests/kms_vblank.c | 18 ++++++++++++++----
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 7689e65b521a..50c16b0debbf 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -72,7 +72,7 @@
 #define TEST_SUSPEND		(1 << 26)
 #define TEST_TS_CONT		(1 << 27)
 #define TEST_BO_TOOBIG		(1 << 28)
-#define TEST_HANG_ONCE		(1 << 29)
+
 #define TEST_BASIC		(1 << 30)
 
 #define EVENT_FLIP		(1 << 0)
@@ -1071,13 +1071,8 @@ static unsigned int wait_for_events(struct test_output *o)
 static unsigned event_loop(struct test_output *o, unsigned duration_ms)
 {
 	unsigned long start, end;
-	igt_hang_t hang;
 	int count = 0;
 
-	memset(&hang, 0, sizeof(hang));
-	if (o->flags & TEST_HANG_ONCE)
-		hang = hang_gpu(drm_fd);
-
 	start = gettime_us();
 
 	while (1) {
@@ -1097,8 +1092,6 @@ static unsigned event_loop(struct test_output *o, unsigned duration_ms)
 
 	end = gettime_us();
 
-	unhang_gpu(drm_fd, hang);
-
 	/* Flush any remaining events */
 	if (o->pending_events)
 		wait_for_events(o);
@@ -1565,7 +1558,6 @@ int main(int argc, char **argv)
 			TEST_CHECK_TS, "flip-vs-blocking-wf-vblank" },
 		{ 30, TEST_FLIP | TEST_MODESET | TEST_HANG | TEST_NOEVENT, "flip-vs-modeset-vs-hang" },
 		{ 30, TEST_FLIP | TEST_PAN | TEST_HANG, "flip-vs-panning-vs-hang" },
-		{ 30, TEST_VBLANK | TEST_HANG_ONCE, "vblank-vs-hang" },
 		{ 1, TEST_FLIP | TEST_EINVAL | TEST_FB_BAD_TILING, "flip-vs-bad-tiling" },
 
 		{ 1, TEST_DPMS_OFF | TEST_MODESET | TEST_FLIP,
diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index 342e4ef23b97..9a5a98743fa6 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -54,6 +54,7 @@ typedef struct {
 #define IDLE 1
 #define BUSY 2
 #define FORKED 4
+#define HANG 8
 } data_t;
 
 static double elapsed(const struct timespec *start,
@@ -122,6 +123,8 @@ static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int))
 	enum pipe p;
 
 	for_each_pipe_with_valid_output(display, p, output) {
+		igt_hang_t hang;
+
 		data->pipe = p;
 		prepare_crtc(data, fd, output);
 
@@ -131,6 +134,9 @@ static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int))
 			 igt_output_name(output),
 			 nchildren);
 
+		if (data->flags & HANG)
+			hang = igt_hang_ring(display->drm_fd, I915_EXEC_DEFAULT);
+
 		if (data->flags & BUSY) {
 			union drm_wait_vblank vbl;
 
@@ -153,6 +159,9 @@ static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int))
 
 		igt_assert(poll(&(struct pollfd){fd, POLLIN}, 1, 0) == 0);
 
+		if (data->flags & HANG)
+			igt_post_hang_ring(fd, hang);
+
 		igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
 			 igt_subtest_name(),
 			 kmstest_pipe_name(data->pipe),
@@ -324,9 +333,9 @@ igt_main
 		void (*func)(data_t *, int, int);
 		unsigned int valid;
 	} funcs[] = {
-		{ "accuracy", accuracy, IDLE },
-		{ "query", vblank_query, IDLE | FORKED | BUSY },
-		{ "wait", vblank_wait, IDLE | FORKED | BUSY },
+		{ "accuracy", accuracy, IDLE | HANG },
+		{ "query", vblank_query, IDLE | FORKED | BUSY | HANG },
+		{ "wait", vblank_wait, IDLE | FORKED | BUSY | HANG },
 		{ }
 	}, *f;
 	const struct {
@@ -357,7 +366,8 @@ igt_main
 			if (m->flags & ~f->valid)
 				continue;
 
-			igt_subtest_f("%s-%s", f->name, m->name) {
+			igt_subtest_f("%s-%s%s", f->name, m->name,
+				      m->flags & HANG ? "-hang" : "") {
 				data.flags = m->flags;
 				run_test(&data, fd, f->func);
 			}
-- 
2.15.1



More information about the Intel-gfx mailing list