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
Subject: [PATCH i-g-t 3/3] tests/kms: Use for_each_crtc_with_valid_output()
Date: Mon, 13 Apr 2026 23:00:21 +0300	[thread overview]
Message-ID: <20260413200021.29485-4-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260413200021.29485-1-ville.syrjala@linux.intel.com>

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

A few tests are doing nested for_each_crtc() and
for_each_valid_output_on_crtc() loops. This is basically
the same as for_each_crtc_with_valid_output(), so just
use that instead. This drops the indentation by two levels,
which is nice.

Note that the original code had the crtc as the outer loop
and output as the inner loop, whereas for_each_crtc_with_valid_output()
does it the other way around. I don't think the difference
should matter here.

And while at it, rename the 'crtc' variable to 'crtc1'
to match the naming of the corresponding output variables.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/kms_display_modes.c  | 61 +++++++++++++++---------------------
 tests/kms_plane_multiple.c | 63 +++++++++++++++-----------------------
 2 files changed, 49 insertions(+), 75 deletions(-)

diff --git a/tests/kms_display_modes.c b/tests/kms_display_modes.c
index 76e73152a2ab..d8aae4256122 100644
--- a/tests/kms_display_modes.c
+++ b/tests/kms_display_modes.c
@@ -178,49 +178,36 @@ static void run_extendedmode_basic(data_t *data, igt_crtc_t *crtc1,
 }
 
 static void run_extendedmode_test(data_t *data) {
-	igt_crtc_t *crtc2;
-	igt_crtc_t *crtc;
 	bool sim_flag = igt_run_in_simulation();
+	igt_crtc_t *crtc1, *crtc2;
 	igt_output_t *output1, *output2;
 	igt_display_t *display = &data->display;
 
 	igt_display_reset(display);
 
-	for_each_crtc(display, crtc) {
-		for_each_valid_output_on_crtc(display,
-					      crtc,
-					      output1) {
-
-			for_each_crtc(display, crtc2) {
-				if (crtc == crtc2)
-					continue;
-
-				for_each_valid_output_on_crtc(display, crtc2, output2) {
-					if (output1 == output2)
-						continue;
-
-					igt_display_reset(display);
-
-					igt_output_set_crtc(output1,
-							    crtc);
-					igt_output_set_crtc(output2,
-							    crtc2);
-
-					if (!intel_pipe_output_combo_valid(display))
-						continue;
-
-					igt_dynamic_f("pipe-%s-%s-pipe-%s-%s",
-						      igt_crtc_name(crtc),
-						      igt_output_name(output1),
-						      igt_crtc_name(crtc2),
-						      igt_output_name(output2))
-						run_extendedmode_basic(data,
-								       crtc,
-								       output1,
-								       crtc2,
-								       output2);
-				}
-			}
+	for_each_crtc_with_valid_output(display, crtc1, output1) {
+		for_each_crtc_with_valid_output(display, crtc2, output2) {
+			if (crtc1 == crtc2)
+				continue;
+
+			if (output1 == output2)
+				continue;
+
+			igt_display_reset(display);
+
+			igt_output_set_crtc(output1, crtc1);
+			igt_output_set_crtc(output2, crtc2);
+
+			if (!intel_pipe_output_combo_valid(display))
+				continue;
+
+			igt_dynamic_f("pipe-%s-%s-pipe-%s-%s",
+				      igt_crtc_name(crtc1), igt_output_name(output1),
+				      igt_crtc_name(crtc2), igt_output_name(output2))
+				run_extendedmode_basic(data,
+						       crtc1, output1,
+						       crtc2, output2);
+
 			/*
 			 * In simulation env, only run the test once with a
 			 * single valid pipe/output pair instead of all combos.
diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 55cee260d01f..0d338eeb5acb 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -524,8 +524,7 @@ static void test_plane_position_2_display(data_t *data, igt_crtc_t *crtc1,
 
 static void run_2_display_test(data_t *data, uint64_t modifier, const char *name)
 {
-	igt_crtc_t *crtc2;
-	igt_crtc_t *crtc;
+	igt_crtc_t *crtc1, *crtc2;
 	igt_output_t *output1, *output2;
 	igt_display_t *display = &data->display;
 
@@ -534,42 +533,30 @@ static void run_2_display_test(data_t *data, uint64_t modifier, const char *name
 
 	igt_display_reset(display);
 
-	for_each_crtc(display, crtc) {
-		for_each_valid_output_on_crtc(display,
-					      crtc,
-					      output1) {
-			for_each_crtc(display, crtc2) {
-				if (crtc == crtc2)
-					continue;
-
-				for_each_valid_output_on_crtc(display, crtc2, output2) {
-					if (output1 == output2)
-						continue;
-
-					igt_display_reset(display);
-
-					igt_output_set_crtc(output1,
-							    crtc);
-					igt_output_set_crtc(output2,
-							    crtc2);
-
-					if (!intel_pipe_output_combo_valid(display))
-						continue;
-
-					igt_dynamic_f("pipe-%s-%s-pipe-%s-%s",
-						       igt_crtc_name(crtc),
-						       output1->name,
-						       igt_crtc_name(crtc2),
-						       output2->name)
-						test_plane_position_2_display(data,
-									      crtc,
-									      crtc2,
-									      output1, output2,
-									      modifier);
-
-					test_fini_2_display(data);
-				}
-			}
+	for_each_crtc_with_valid_output(display, crtc1, output1) {
+		for_each_crtc_with_valid_output(display, crtc2, output2) {
+			if (crtc1 == crtc2)
+				continue;
+
+			if (output1 == output2)
+				continue;
+
+			igt_display_reset(display);
+
+			igt_output_set_crtc(output1, crtc1);
+			igt_output_set_crtc(output2, crtc2);
+
+			if (!intel_pipe_output_combo_valid(display))
+				continue;
+
+			igt_dynamic_f("pipe-%s-%s-pipe-%s-%s",
+				      igt_crtc_name(crtc1), output1->name,
+				      igt_crtc_name(crtc2), output2->name)
+				test_plane_position_2_display(data,
+							      crtc1, crtc2,
+							      output1, output2,
+							      modifier);
+			test_fini_2_display(data);
 		}
 	}
 }
-- 
2.52.0


  parent reply	other threads:[~2026-04-13 20:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 20:00 [PATCH i-g-t 0/3] tests/kms: Nuke local iterator macros Ville Syrjala
2026-04-13 20:00 ` [PATCH i-g-t 1/3] lib/kms: Avoid local iterator variable in for_each_output() Ville Syrjala
2026-04-13 20:00 ` [PATCH i-g-t 2/3] tests/kms: Nuke local copies of for_each_valid_output_on_crtc() Ville Syrjala
2026-04-13 20:00 ` Ville Syrjala [this message]
2026-04-14  1:24 ` ✗ i915.CI.BAT: failure for tests/kms: Nuke local iterator macros Patchwork
2026-04-14  1:37 ` ✓ Xe.CI.BAT: success " Patchwork
2026-04-14  4:38 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-14  7:00 ` [PATCH i-g-t 0/3] " Jani Nikula
2026-04-15 16:41 ` ✓ Xe.CI.BAT: success for tests/kms: Nuke local iterator macros (rev2) Patchwork
2026-04-15 17:02 ` ✓ i915.CI.BAT: " Patchwork
2026-04-15 18:23 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-15 23:07 ` ✗ i915.CI.Full: " 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=20260413200021.29485-4-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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