[Intel-gfx] [PATCH i-g-t v1 5/6] tests/kms_cursor_legacy: Switch to using for_each_pipe construct

Robert Foss robert.foss at collabora.com
Thu Jan 19 16:35:05 UTC 2017


Avoid using hand-rolled construct for iterating over all pipes.

Signed-off-by: Robert Foss <robert.foss at collabora.com>
---
 tests/kms_cursor_legacy.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 5e9f5f39..156bd0c7 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1360,6 +1360,7 @@ igt_main
 {
 	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
 	igt_display_t display = { .drm_fd = -1 };
+	enum pipe pipe;
 	int i;
 
 	igt_skip_on_simulation();
@@ -1373,27 +1374,23 @@ igt_main
 	}
 
 	igt_subtest_group {
-		for (int n = 0; n < I915_MAX_PIPES; n++) {
+		for_each_pipe(&display, pipe) {
 			errno = 0;
 
-			igt_fixture {
-				igt_skip_on(n >= display.n_pipes);
-			}
-
-			igt_subtest_f("pipe-%s-single-bo", kmstest_pipe_name(n))
-				stress(&display, n, 1, DRM_MODE_CURSOR_BO, 20);
-			igt_subtest_f("pipe-%s-single-move", kmstest_pipe_name(n))
-				stress(&display, n, 1, DRM_MODE_CURSOR_MOVE, 20);
+			igt_subtest_f("pipe-%s-single-bo", kmstest_pipe_name(pipe))
+				stress(&display, pipe, 1, DRM_MODE_CURSOR_BO, 20);
+			igt_subtest_f("pipe-%s-single-move", kmstest_pipe_name(pipe))
+				stress(&display, pipe, 1, DRM_MODE_CURSOR_MOVE, 20);
 
-			igt_subtest_f("pipe-%s-forked-bo", kmstest_pipe_name(n))
-				stress(&display, n, ncpus, DRM_MODE_CURSOR_BO, 20);
-			igt_subtest_f("pipe-%s-forked-move", kmstest_pipe_name(n))
-				stress(&display, n, ncpus, DRM_MODE_CURSOR_MOVE, 20);
+			igt_subtest_f("pipe-%s-forked-bo", kmstest_pipe_name(pipe))
+				stress(&display, pipe, ncpus, DRM_MODE_CURSOR_BO, 20);
+			igt_subtest_f("pipe-%s-forked-move", kmstest_pipe_name(pipe))
+				stress(&display, pipe, ncpus, DRM_MODE_CURSOR_MOVE, 20);
 
-			igt_subtest_f("pipe-%s-torture-bo", kmstest_pipe_name(n))
-				stress(&display, n, -ncpus, DRM_MODE_CURSOR_BO, 20);
-			igt_subtest_f("pipe-%s-torture-move", kmstest_pipe_name(n))
-				stress(&display, n, -ncpus, DRM_MODE_CURSOR_MOVE, 20);
+			igt_subtest_f("pipe-%s-torture-bo", kmstest_pipe_name(pipe))
+				stress(&display, pipe, -ncpus, DRM_MODE_CURSOR_BO, 20);
+			igt_subtest_f("pipe-%s-torture-move", kmstest_pipe_name(pipe))
+				stress(&display, pipe, -ncpus, DRM_MODE_CURSOR_MOVE, 20);
 		}
 	}
 
-- 
2.11.0



More information about the Intel-gfx mailing list