[PATCH i-g-t 10/16] tests/amdgpu/amd_dp_dsc: use for_each_output()

Jani Nikula
2026-04-14T07:17:17Z

Use for_each_output() instead of manually iterating display->outputs[i].

Tweak the CRTC limit check slightly when removing the for loop.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tests/amdgpu/amd_dp_dsc.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/amdgpu/amd_dp_dsc.c b/tests/amdgpu/amd_dp_dsc.c
index c04f4d003267..b8441163681e 100644
--- a/tests/amdgpu/amd_dp_dsc.c
+++ b/tests/amdgpu/amd_dp_dsc.c
@@ -60,8 +60,9 @@ static void test_fini(data_t *data)
static void test_init(data_t *data)
{
igt_display_t *display = &data->display;
+ igt_output_t *output;
igt_crtc_t *crtc;
- int i, n;
+ int n = 0;

for_each_crtc(display, crtc) {
data->crtc[crtc->crtc_index] = crtc;
@@ -71,9 +72,10 @@ static void test_init(data_t *data)
igt_crtc_crc_new(crtc, IGT_PIPE_CRC_SOURCE_AUTO);
}

- for (i = 0,
- n = 0; i < display->n_outputs && n < igt_display_n_crtcs(display); ++i) {
- igt_output_t *output = &display->outputs[i];
+ for_each_output(display, output) {
+ if (n == igt_display_n_crtcs(display))
+ break;
+
data->output[n] = output;

/* Only allow physically connected displays for the tests. */
--
2.47.3