public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lyude Paul <lyude@redhat.com>
Subject: [PATCH i-g-t 2/5] tests/nouveau_crc: Convert to dynamic subtests
Date: Thu,  5 Mar 2026 15:40:35 +0200	[thread overview]
Message-ID: <20260305134038.6995-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260305134038.6995-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

nouveau_crc is the last holdout for for_each_pipe_static(). Convert
the tests to use dynamic per-pipe subtests so that we can nuke
for_each_pipe_static() and convert everything to use igt_crtc_t.

Untested due to lack of hardware.

Cc: Lyude Paul <lyude@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_kms.h       |  12 -----
 tests/nouveau_crc.c | 113 ++++++++++++++++++++++++++------------------
 2 files changed, 68 insertions(+), 57 deletions(-)

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index e91c6567757e..9514ef03f0e8 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -720,18 +720,6 @@ static inline bool igt_crtc_connector_valid(igt_crtc_t *crtc, igt_output_t *outp
 	for_each_output((display), (output))	\
 		for_each_if ((!(igt_output_is_connected((output)))))
 
-/**
- * for_each_pipe_static:
- * @pipe: The pipe to iterate.
- *
- * This for loop iterates over all pipes supported by IGT libraries.
- *
- * This should be used to enumerate per-pipe subtests since it has no runtime
- * depencies.
- */
-#define for_each_pipe_static(pipe) \
-	for (pipe = 0; pipe < IGT_MAX_PIPES; pipe++)
-
 /**
  * for_each_crtc:
  * @display: a pointer to an #igt_display_t structure
diff --git a/tests/nouveau_crc.c b/tests/nouveau_crc.c
index 393414339ab0..59fa8a2daeb8 100644
--- a/tests/nouveau_crc.c
+++ b/tests/nouveau_crc.c
@@ -297,6 +297,16 @@ static void test_source(data_t *data, const char *source)
 	free(crcs);
 }
 
+static void test_source_outp_complete(data_t *data)
+{
+	test_source(data, "outp-complete");
+}
+
+static void test_source_rg(data_t *data)
+{
+	test_source(data, "rg");
+}
+
 static void test_source_outp_inactive(data_t *data)
 {
 	struct color_fb colors[] = {
@@ -365,13 +375,17 @@ static void cleanup_test(data_t *data)
 	close(data->nv_crc_dir);
 }
 
+static void run_test(data_t *data, void (*test)(data_t *data))
+{
+	setup_test(data);
+	test(data);
+	cleanup_test(data);
+}
+
 data_t data = {0};
 
-#define pipe_test(name) igt_subtest_f("pipe-%s-" name, kmstest_pipe_name(pipe))
 int igt_main()
 {
-	int pipe;
-
 	igt_fixture() {
 		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
 		igt_require_nouveau(data.drm_fd);
@@ -383,50 +397,59 @@ int igt_main()
 		igt_display_reset(&data.display);
 	}
 
-	for_each_pipe_static(pipe) {
-		igt_fixture() {
-			data.crtc = igt_crtc_for_pipe(&data.display, pipe);
-			igt_require(data.crtc->valid);
-
-			setup_test(&data);
+	/* We don't need to test this on every pipe, but the setup is the same */
+	igt_describe("Make sure that the CRC notifier context flip threshold "
+		     "is reset to its default value after a single capture.");
+	igt_subtest("ctx-flip-threshold-reset-after-capture") {
+		data.crtc = igt_crtc_for_pipe(&data.display, PIPE_A);
+		igt_require(data.crtc->valid);
+
+		run_test(&data, test_ctx_flip_threshold_reset_after_capture);
+	}
+
+	igt_describe("Make sure the association between each CRC and its "
+		     "respective frame index is not broken when the driver "
+		     "performs a notifier context flip.");
+	igt_subtest("ctx-flip-detection") {
+		for_each_crtc(&data.display, data.crtc) {
+			igt_dynamic_f("pipe-%s", igt_crtc_name(data.crtc))
+				run_test(&data, test_ctx_flip_detection);
 		}
-
-		/* We don't need to test this on every pipe, but the setup is the same */
-		if (pipe == PIPE_A) {
-			igt_describe("Make sure that the CRC notifier context flip threshold "
-				     "is reset to its default value after a single capture.");
-			igt_subtest("ctx-flip-threshold-reset-after-capture")
-				test_ctx_flip_threshold_reset_after_capture(&data);
+	}
+
+	igt_describe("Make sure that igt_pipe_crc_get_current() works even "
+		     "when the CRC for the current frame index is lost.");
+	igt_subtest("ctx-flip-skip-current-frame") {
+		for_each_crtc(&data.display, data.crtc) {
+			igt_dynamic_f("pipe-%s", igt_crtc_name(data.crtc))
+				run_test(&data, test_ctx_flip_skip_current_frame);
 		}
-
-		igt_describe("Make sure the association between each CRC and its "
-			     "respective frame index is not broken when the driver "
-			     "performs a notifier context flip.");
-		pipe_test("ctx-flip-detection")
-			test_ctx_flip_detection(&data);
-
-		igt_describe("Make sure that igt_pipe_crc_get_current() works even "
-			     "when the CRC for the current frame index is lost.");
-		pipe_test("ctx-flip-skip-current-frame")
-			test_ctx_flip_skip_current_frame(&data);
-
-		igt_describe("Check that basic CRC readback using the outp-complete "
-			     "source works.");
-		pipe_test("source-outp-complete")
-			test_source(&data, "outp-complete");
-
-		igt_describe("Check that basic CRC readback using the rg source "
-			     "works.");
-		pipe_test("source-rg")
-			test_source(&data, "rg");
-
-		igt_describe("Make sure that the outp-inactive source is actually "
-			     "capturing the inactive raster.");
-		pipe_test("source-outp-inactive")
-			test_source_outp_inactive(&data);
-
-		igt_fixture() {
-			cleanup_test(&data);
+	}
+
+	igt_describe("Check that basic CRC readback using the outp-complete "
+		     "source works.");
+	igt_subtest("source-outp-complete") {
+		for_each_crtc(&data.display, data.crtc) {
+			igt_dynamic_f("pipe-%s", igt_crtc_name(data.crtc))
+				run_test(&data, test_source_outp_complete);
+		}
+	}
+
+	igt_describe("Check that basic CRC readback using the rg source "
+		     "works.");
+	igt_subtest("source-rg") {
+		for_each_crtc(&data.display, data.crtc) {
+			igt_dynamic_f("pipe-%s", igt_crtc_name(data.crtc))
+				run_test(&data, test_source_rg);
+		}
+	}
+
+	igt_describe("Make sure that the outp-inactive source is actually "
+		     "capturing the inactive raster.");
+	igt_subtest("source-outp-inactive") {
+		for_each_crtc(&data.display, data.crtc) {
+			igt_dynamic_f("pipe-%s", igt_crtc_name(data.crtc))
+				run_test(&data, test_source_outp_inactive);
 		}
 	}
 
-- 
2.52.0


  parent reply	other threads:[~2026-03-05 13:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 13:40 [PATCH i-g-t 0/5] kms: A bit more cleanup around igt_kms Ville Syrjala
2026-03-05 13:40 ` [PATCH i-g-t 1/5] tests/nouveau_crc: Extract {setup,cleanup}_test() Ville Syrjala
2026-03-06 11:00   ` Jani Nikula
2026-03-06 20:57   ` Lyude Paul
2026-03-05 13:40 ` Ville Syrjala [this message]
2026-03-06 11:13   ` [PATCH i-g-t 2/5] tests/nouveau_crc: Convert to dynamic subtests Jani Nikula
2026-03-06 11:38     ` Ville Syrjälä
2026-03-05 13:40 ` [PATCH i-g-t 3/5] tests/nouveau_crc: Use igt_first_crtc() instead of igt_crtc_for_pipe() Ville Syrjala
2026-03-06 11:14   ` Jani Nikula
2026-03-06 20:57   ` Lyude Paul
2026-03-05 13:40 ` [PATCH i-g-t 4/5] lib/kms: Make igt_first_crtc() skip if no CRTCs are around Ville Syrjala
2026-03-06 11:17   ` Jani Nikula
2026-03-05 13:40 ` [PATCH i-g-t 5/5] lib/kms: Make igt_first_crtc_with_single_output() skip if no CRTC/output can be found Ville Syrjala
2026-03-06 11:19   ` Jani Nikula
2026-03-05 23:16 ` ✗ Xe.CI.BAT: failure for kms: A bit more cleanup around igt_kms Patchwork
2026-03-05 23:20 ` ✓ i915.CI.BAT: success " Patchwork
2026-03-06 16:32 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-03-07  3:53 ` ✓ i915.CI.Full: success " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260305134038.6995-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox