[Intel-gfx] [PATCH i-g-t 4/7] kms_vblank: Make the -hang tests work as intended

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


Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_vblank.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index a83500635976..45301ca5110f 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -54,7 +54,7 @@ typedef struct {
 #define IDLE 1
 #define BUSY 2
 #define FORKED 4
-#define HANG 8
+#define NOHANG 8
 } data_t;
 
 static double elapsed(const struct timespec *start,
@@ -128,7 +128,7 @@ static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int))
 		 igt_subtest_name(), kmstest_pipe_name(data->pipe),
 		 igt_output_name(output), nchildren);
 
-	if (data->flags & HANG)
+	if (!(data->flags & NOHANG))
 		hang = igt_hang_ring(display->drm_fd, I915_EXEC_DEFAULT);
 
 	if (data->flags & BUSY) {
@@ -153,7 +153,7 @@ 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)
+	if (!(data->flags & NOHANG))
 		igt_post_hang_ring(fd, hang);
 
 	igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
@@ -324,9 +324,9 @@ igt_main
 		void (*func)(data_t *, int, int);
 		unsigned int valid;
 	} funcs[] = {
-		{ "accuracy", accuracy, IDLE | HANG },
-		{ "query", vblank_query, IDLE | FORKED | BUSY | HANG },
-		{ "wait", vblank_wait, IDLE | FORKED | BUSY | HANG },
+		{ "accuracy", accuracy, IDLE },
+		{ "query", vblank_query, IDLE | FORKED | BUSY },
+		{ "wait", vblank_wait, IDLE | FORKED | BUSY },
 		{ }
 	}, *f;
 	enum pipe p;
@@ -365,15 +365,28 @@ igt_main
 				if (m->flags & ~f->valid)
 					continue;
 
-				igt_subtest_f("pipe-%s-%s-%s%s",
+				igt_subtest_f("pipe-%s-%s-%s",
 					      kmstest_pipe_name(data.pipe),
-					      f->name, m->name,
-					      m->flags & HANG ? "-hang" : "") {
+					      f->name, m->name) {
+					for_each_valid_output_on_pipe(&data.display, data.pipe, data.output) {
+						data.flags = m->flags | NOHANG;
+						run_test(&data, fd, f->func);
+					}
+				}
+
+				/* Skip the -hang version if NOHANG flag is set */
+				if (f->valid & NOHANG)
+					continue;
+
+				igt_subtest_f("pipe-%s-%s-%s-hang",
+					      kmstest_pipe_name(data.pipe),
+					      f->name, m->name) {
 					for_each_valid_output_on_pipe(&data.display, data.pipe, data.output) {
 						data.flags = m->flags;
 						run_test(&data, fd, f->func);
 					}
 				}
+
 			}
 		}
 	}
-- 
2.15.1



More information about the Intel-gfx mailing list