[igt-dev] [PATCH i-g-t 1/4] tests/kms_cursor_crc: Run tests once per pipe

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Mon Apr 29 16:05:54 UTC 2019


Instead of running tests on all pipes and all outputs,
change the tests to only run once on each pipe, with
igt_get_single_output_for_pipe() to select an output.

This way we'll test all pipes and all outputs at least once,
but not all combinations. This reduces the amount of time
required for each test with dual/triple outputs.

In order to reduce the test time further, only run the
DPMS/suspend tests once for each pipe. They should not
be dependent on cursor size.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_cursor_crc.c | 125 +++++++++++++++++++----------------------
 1 file changed, 57 insertions(+), 68 deletions(-)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index fd74fda5c5f0..7e6c522c438b 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -462,42 +462,11 @@ static void test_cursor_opaque(data_t *data)
 	test_cursor_alpha(data, 1.0);
 }
 
-
 static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int cursor_h)
 {
-	igt_display_t *display = &data->display;
-	igt_output_t *output;
-	enum pipe p;
-	int valid_tests = 0;
-
-	igt_require(cursor_w <= data->cursor_max_w &&
-		    cursor_h <= data->cursor_max_h);
-
-	for_each_pipe_with_valid_output(display, p, output) {
-		data->output = output;
-		data->pipe = p;
-
-		prepare_crtc(data, output, cursor_w, cursor_h);
-
-		valid_tests++;
-
-		igt_info("Beginning %s on pipe %s, connector %s\n",
-			  igt_subtest_name(),
-			  kmstest_pipe_name(data->pipe),
-			  igt_output_name(output));
-
-		testfunc(data);
-
-		igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
-			  igt_subtest_name(),
-			  kmstest_pipe_name(data->pipe),
-			  igt_output_name(output));
-
-		/* cleanup what prepare_crtc() has done */
-		cleanup_crtc(data, output);
-	}
-
-	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+	prepare_crtc(data, data->output, cursor_w, cursor_h);
+	testfunc(data);
+	cleanup_crtc(data, data->output);
 }
 
 static void create_cursor_fb(data_t *data, int cur_w, int cur_h)
@@ -639,38 +608,66 @@ static void test_rapid_movement(data_t *data)
 
 }
 
-static void run_test_generic(data_t *data)
+static void run_tests_on_pipe(data_t *data, enum pipe pipe)
 {
 	int cursor_size;
+
+	igt_fixture {
+		data->pipe = pipe;
+		data->output = igt_get_single_output_for_pipe(&data->display, pipe);
+		igt_require(data->output);
+	}
+
+	igt_subtest_f("pipe-%s-cursor-size-change", kmstest_pipe_name(pipe))
+		run_test(data, test_cursor_size,
+			 data->cursor_max_w, data->cursor_max_h);
+
+	igt_subtest_f("pipe-%s-cursor-alpha-opaque", kmstest_pipe_name(pipe))
+		run_test(data, test_cursor_opaque, data->cursor_max_w, data->cursor_max_h);
+
+	igt_subtest_f("pipe-%s-cursor-alpha-transparent", kmstest_pipe_name(pipe))
+		run_test(data, test_cursor_transparent, data->cursor_max_w, data->cursor_max_h);
+
+	igt_fixture
+		create_cursor_fb(data, data->cursor_max_w, data->cursor_max_h);
+
+	igt_subtest_f("pipe-%s-cursor-dpms", kmstest_pipe_name(pipe)) {
+		data->flags = TEST_DPMS;
+		run_test(data, test_crc_random, data->cursor_max_w, data->cursor_max_h);
+	}
+	data->flags = 0;
+
+	igt_subtest_f("pipe-%s-cursor-suspend", kmstest_pipe_name(pipe)) {
+		data->flags = TEST_SUSPEND;
+		run_test(data, test_crc_random, data->cursor_max_w, data->cursor_max_h);
+	}
+	data->flags = 0;
+
+	igt_fixture
+		igt_remove_fb(data->drm_fd, &data->fb);
+
 	for (cursor_size = 64; cursor_size <= 512; cursor_size *= 2) {
 		int w = cursor_size;
 		int h = cursor_size;
 
-		igt_fixture
+		igt_fixture {
+			igt_require(w <= data->cursor_max_w &&
+				    h <= data->cursor_max_h);
+
 			create_cursor_fb(data, w, h);
+		}
 
 		/* Using created cursor FBs to test cursor support */
-		igt_subtest_f("cursor-%dx%d-onscreen", w, h)
+		igt_subtest_f("pipe-%s-cursor-%dx%d-onscreen", kmstest_pipe_name(pipe), w, h)
 			run_test(data, test_crc_onscreen, w, h);
-		igt_subtest_f("cursor-%dx%d-offscreen", w, h)
+		igt_subtest_f("pipe-%s-cursor-%dx%d-offscreen", kmstest_pipe_name(pipe), w, h)
 			run_test(data, test_crc_offscreen, w, h);
-		igt_subtest_f("cursor-%dx%d-sliding", w, h)
+		igt_subtest_f("pipe-%s-cursor-%dx%d-sliding", kmstest_pipe_name(pipe), w, h)
 			run_test(data, test_crc_sliding, w, h);
-		igt_subtest_f("cursor-%dx%d-random", w, h)
+		igt_subtest_f("pipe-%s-cursor-%dx%d-random", kmstest_pipe_name(pipe), w, h)
 			run_test(data, test_crc_random, w, h);
-		igt_subtest_f("cursor-%dx%d-dpms", w, h) {
-			data->flags = TEST_DPMS;
-			run_test(data, test_crc_random, w, h);
-			data->flags = 0;
-		}
-
-		igt_subtest_f("cursor-%dx%d-suspend", w, h) {
-			data->flags = TEST_SUSPEND;
-			run_test(data, test_crc_random, w, h);
-			data->flags = 0;
-		}
 
-		igt_subtest_f("cursor-%dx%d-rapid-movement", w, h) {
+		igt_subtest_f("pipe-%s-cursor-%dx%d-rapid-movement", kmstest_pipe_name(pipe), w, h) {
 			run_test(data, test_rapid_movement, w, h);
 		}
 
@@ -688,19 +685,19 @@ static void run_test_generic(data_t *data)
 			create_cursor_fb(data, w, h);
 
 		/* Using created cursor FBs to test cursor support */
-		igt_subtest_f("cursor-%dx%d-onscreen", w, h) {
+		igt_subtest_f("pipe-%s-cursor-%dx%d-onscreen", kmstest_pipe_name(pipe), w, h) {
 			igt_require(has_nonsquare_cursors(data));
 			run_test(data, test_crc_onscreen, w, h);
 		}
-		igt_subtest_f("cursor-%dx%d-offscreen", w, h) {
+		igt_subtest_f("pipe-%s-cursor-%dx%d-offscreen", kmstest_pipe_name(pipe), w, h) {
 			igt_require(has_nonsquare_cursors(data));
 			run_test(data, test_crc_offscreen, w, h);
 		}
-		igt_subtest_f("cursor-%dx%d-sliding", w, h) {
+		igt_subtest_f("pipe-%s-cursor-%dx%d-sliding", kmstest_pipe_name(pipe), w, h) {
 			igt_require(has_nonsquare_cursors(data));
 			run_test(data, test_crc_sliding, w, h);
 		}
-		igt_subtest_f("cursor-%dx%d-random", w, h) {
+		igt_subtest_f("pipe-%s-cursor-%dx%d-random", kmstest_pipe_name(pipe), w, h) {
 			igt_require(has_nonsquare_cursors(data));
 			run_test(data, test_crc_random, w, h);
 		}
@@ -716,6 +713,7 @@ igt_main
 {
 	uint64_t cursor_width = 64, cursor_height = 64;
 	int ret;
+	enum pipe pipe;
 
 	igt_skip_on_simulation();
 
@@ -741,18 +739,9 @@ igt_main
 	data.cursor_max_w = cursor_width;
 	data.cursor_max_h = cursor_height;
 
-	igt_subtest_f("cursor-size-change")
-		run_test(&data, test_cursor_size, cursor_width, cursor_height);
-
-	igt_subtest_f("cursor-alpha-opaque") {
-		run_test(&data, test_cursor_opaque, cursor_width, cursor_height);
-	 }
-
-	igt_subtest_f("cursor-alpha-transparent") {
-		run_test(&data, test_cursor_transparent, cursor_width, cursor_height);
-	 }
-
-	run_test_generic(&data);
+	for_each_pipe_static(pipe)
+		igt_subtest_group
+			run_tests_on_pipe(&data, pipe);
 
 	igt_fixture {
 		igt_display_fini(&data.display);
-- 
2.20.1



More information about the igt-dev mailing list