[PATCH i-g-t 2/3] tests/kms: Nuke local copies of for_each_valid_output_on_crtc()

Ville Syrjala
2026-04-13T20:00:56Z

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

A few tests need to nest two for_each_valid_output_on_crtc() loops.
Now that the local iterator variable is removed from for_each_output()
we can just nest the real thing without problems.

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

diff --git a/tests/kms_display_modes.c b/tests/kms_display_modes.c
index 18582cf1500c..76e73152a2ab 100644
--- a/tests/kms_display_modes.c
+++ b/tests/kms_display_modes.c
@@ -177,15 +177,6 @@ static void run_extendedmode_basic(data_t *data, igt_crtc_t *crtc1,
igt_assert_crc_equal(&crc[1], &ref_crc[1]);
}

-#define for_each_connected_output_local(display, output) \
- for (int j__ = 0; assert(igt_can_fail()), j__ < (display)->n_outputs; j__++) \
- for_each_if ((((output) = &(display)->outputs[j__]), \
- igt_output_is_connected((output))))
-
-#define for_each_valid_output_on_crtc_local(display, crtc, output) \
- for_each_connected_output_local((display), (output)) \
- for_each_if (igt_crtc_connector_valid((crtc), (output)))
-
static void run_extendedmode_test(data_t *data) {
igt_crtc_t *crtc2;
igt_crtc_t *crtc;
@@ -204,8 +195,7 @@ static void run_extendedmode_test(data_t *data) {
if (crtc == crtc2)
continue;

- for_each_valid_output_on_crtc_local(display, crtc2,
- output2) {
+ for_each_valid_output_on_crtc(display, crtc2, output2) {
if (output1 == output2)
continue;

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index d8a32d9526ad..55cee260d01f 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -522,15 +522,6 @@ static void test_plane_position_2_display(data_t *data, igt_crtc_t *crtc1,
igt_assert_crc_equal(&data->ref_crc2, &crc2);
}

-#define for_each_connected_output_local(display, output) \
- for (int j__ = 0; assert(igt_can_fail()), j__ < (display)->n_outputs; j__++) \
- for_each_if((((output) = &(display)->outputs[j__]), \
- igt_output_is_connected((output))))
-
-#define for_each_valid_output_on_crtc_local(display, crtc, output) \
- for_each_connected_output_local((display), (output)) \
- for_each_if(igt_crtc_connector_valid((crtc), (output)))
-
static void run_2_display_test(data_t *data, uint64_t modifier, const char *name)
{
igt_crtc_t *crtc2;
@@ -551,8 +542,7 @@ static void run_2_display_test(data_t *data, uint64_t modifier, const char *name
if (crtc == crtc2)
continue;

- for_each_valid_output_on_crtc_local(display, crtc2,
- output2) {
+ for_each_valid_output_on_crtc(display, crtc2, output2) {
if (output1 == output2)
continue;

--
2.52.0