[PATCH i-g-t v2 2/6] kms_vblank: Reorganize subtests by pipe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
---
 tests/kms_vblank.c | 93 ++++++++++++++++++++++++++++--------------------------
 1 file changed, 49 insertions(+), 44 deletions(-)

diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index 342e4ef23b97..e51e96c7f061 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -118,49 +118,41 @@ static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int))
 	int nchildren =
 		data->flags & FORKED ? sysconf(_SC_NPROCESSORS_ONLN) : 1;
 	igt_display_t *display = &data->display;
-	igt_output_t *output;
-	enum pipe p;
+	igt_output_t *output = data->output;
 
-	for_each_pipe_with_valid_output(display, p, output) {
-		data->pipe = p;
-		prepare_crtc(data, fd, output);
+	prepare_crtc(data, fd, output);
 
-		igt_info("Beginning %s on pipe %s, connector %s (%d threads)\n",
-			 igt_subtest_name(),
-			 kmstest_pipe_name(data->pipe),
-			 igt_output_name(output),
-			 nchildren);
-
-		if (data->flags & BUSY) {
-			union drm_wait_vblank vbl;
-
-			memset(&vbl, 0, sizeof(vbl));
-			vbl.request.type =
-				DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
-			vbl.request.type |= kmstest_get_vbl_flag(data->pipe);
-			vbl.request.sequence = 120 + 12;
-			igt_assert_eq(wait_vblank(fd, &vbl), 0);
-		}
+	igt_info("Beginning %s on pipe %s, connector %s (%d threads)\n",
+		 igt_subtest_name(), kmstest_pipe_name(data->pipe),
+		 igt_output_name(output), nchildren);
 
-		igt_fork(child, nchildren)
-			testfunc(data, fd, nchildren);
-		igt_waitchildren();
-
-		if (data->flags & BUSY) {
-			struct drm_event_vblank buf;
-			igt_assert_eq(read(fd, &buf, sizeof(buf)), sizeof(buf));
-		}
+	if (data->flags & BUSY) {
+		union drm_wait_vblank vbl;
 
-		igt_assert(poll(&(struct pollfd){fd, POLLIN}, 1, 0) == 0);
+		memset(&vbl, 0, sizeof(vbl));
+		vbl.request.type =
+			DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
+		vbl.request.type |= kmstest_get_vbl_flag(data->pipe);
+		vbl.request.sequence = 120 + 12;
+		igt_assert_eq(wait_vblank(fd, &vbl), 0);
+	}
 
-		igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
-			 igt_subtest_name(),
-			 kmstest_pipe_name(data->pipe),
-			 igt_output_name(output));
+	igt_fork(child, nchildren)
+		testfunc(data, fd, nchildren);
+	igt_waitchildren();
 
-		/* cleanup what prepare_crtc() has done */
-		cleanup_crtc(data, fd, output);
+	if (data->flags & BUSY) {
+		struct drm_event_vblank buf;
+		igt_assert_eq(read(fd, &buf, sizeof(buf)), sizeof(buf));
 	}
+
+	igt_assert(poll(&(struct pollfd){fd, POLLIN}, 1, 0) == 0);
+
+	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, fd, output);
 }
 
 static void crtc_id_subtest(data_t *data, int fd)
@@ -329,6 +321,8 @@ igt_main
 		{ "wait", vblank_wait, IDLE | FORKED | BUSY },
 		{ }
 	}, *f;
+	enum pipe p;
+
 	const struct {
 		const char *name;
 		unsigned int flags;
@@ -352,14 +346,25 @@ igt_main
 	igt_subtest("crtc-id")
 		crtc_id_subtest(&data, fd);
 
-	for (f = funcs; f->name; f++) {
-		for (m = modes; m->name; m++) {
-			if (m->flags & ~f->valid)
-				continue;
-
-			igt_subtest_f("%s-%s", f->name, m->name) {
-				data.flags = m->flags;
-				run_test(&data, fd, f->func);
+	for_each_pipe_static(p) igt_subtest_group {
+		igt_fixture
+			igt_display_require_output_on_pipe(&data.display, p);
+
+		data.pipe = p;
+
+		for (f = funcs; f->name; f++) {
+			for (m = modes; m->name; m++) {
+				if (m->flags & ~f->valid)
+					continue;
+
+				igt_subtest_f("pipe-%s-%s-%s",
+					      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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux