[CI 3/5] tests/kms_bw: avoid igt_crtc_for_pipe() and crtc->pipe usage

Jani Nikula
2026-03-24T09:02:16Z

The test doesn't really care about pipes. It does conflate a lot of
loops with pipes. Try to avoid that by using the CRTC index instead.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tests/kms_bw.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/tests/kms_bw.c b/tests/kms_bw.c
index 056aa667d795..4df5c2cee885 100644
--- a/tests/kms_bw.c
+++ b/tests/kms_bw.c
@@ -125,12 +125,11 @@ static void test_init(data_t *data, bool physical)
data->connected_outputs = 0;

for_each_crtc(display, crtc) {
- data->crtc[crtc->pipe] = crtc;
- data->primary[crtc->pipe] = igt_crtc_get_plane_type(crtc,
- DRM_PLANE_TYPE_PRIMARY);
- data->pipe_crc[crtc->pipe] =
- igt_crtc_crc_new(crtc,
- IGT_PIPE_CRC_SOURCE_AUTO);
+ data->crtc[crtc->crtc_index] = crtc;
+ data->primary[crtc->crtc_index] =
+ igt_crtc_get_plane_type(crtc, DRM_PLANE_TYPE_PRIMARY);
+ data->pipe_crc[crtc->crtc_index] =
+ igt_crtc_crc_new(crtc, IGT_PIPE_CRC_SOURCE_AUTO);
}

for (i = 0; i < display->n_outputs && i < max_pipes; i++) {
@@ -163,8 +162,8 @@ static void test_fini(data_t *data)
igt_crtc_t *crtc;

for_each_crtc(display, crtc) {
- if (data->pipe_crc[crtc->pipe])
- igt_pipe_crc_free(data->pipe_crc[crtc->pipe]);
+ if (data->pipe_crc[crtc->crtc_index])
+ igt_pipe_crc_free(data->pipe_crc[crtc->crtc_index]);
}

igt_display_reset(display);
@@ -240,7 +239,7 @@ static void run_test_linear_tiling(data_t *data, int n_crtcs, const drmModeModeI

/* create buffers */
for (i = 0; i < n_crtcs; i++) {
- crtc = igt_crtc_for_pipe(display, i);
+ crtc = data->crtc[i];

output = physical ? data->connected_output[i] : data->output[i];
if (!output || !output_mode_supported(output, mode)) {
--
2.47.3