[PATCH i-g-t 14/17] tests/kms_display_modes: Use igt_crtc_t instead of enum pipe

Ville Syrjala
2026-02-11T16:35:10Z

tests/kms_display_modes.

The complication here is the use of multiple pipes/crtcs
simultaneously.

#include "scripts/iterators.cocci"

@func@
typedef igt_crtc_t;
identifier FUNC, PIPE1, PIPE2;
parameter list[N] P;
parameter list[N2] P2;
@@
FUNC(P
- ,enum pipe PIPE1
+ ,igt_crtc_t *crtc1
,P2
- ,enum pipe PIPE2
+ ,igt_crtc_t *crtc2
,...)
{
<+...
(
- igt_crtc_for_pipe(..., PIPE1)
+ crtc1
|
- kmsetst_crtc_name(PIPE1)
+ igt_crtc_name(crtc1)
|
- PIPE1
+ crtc1->pipe
|
- igt_crtc_for_pipe(..., PIPE2)
+ crtc2
|
- kmsetst_crtc_name(PIPE2)
+ igt_crtc_name(crtc2)
|
- PIPE2
+ crtc2->pipe
)
...+>
}

@depends on func@
identifier func.FUNC;
expression PIPE1, PIPE2;
expression list[func.N] EP;
expression list[func.N2] EP2;
@@
FUNC(EP
- ,PIPE1
+ ,igt_crtc_for_pipe(display, PIPE1)
,EP2
- ,PIPE2
+ ,igt_crtc_for_pipe(display, PIPE2)
,...)

@@
igt_crtc_t *CRTC;
@@
- igt_crtc_for_pipe(..., CRTC->pipe)
+ CRTC

@@
typedef igt_display_t;
identifier DISPLAY;
expression E;
@@
- igt_display_t *DISPLAY = E;
... when != DISPLAY

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/kms_display_modes.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tests/kms_display_modes.c b/tests/kms_display_modes.c
index f3888375c966..60585bed0218 100644
--- a/tests/kms_display_modes.c
+++ b/tests/kms_display_modes.c
@@ -72,9 +72,9 @@ static bool output_is_dp_mst(data_t *data, igt_output_t *output, int i)
return true;
}

-static void run_extendedmode_basic(data_t *data,
- enum pipe pipe1, igt_output_t *output1,
- enum pipe pipe2, igt_output_t *output2)
+static void run_extendedmode_basic(data_t *data, igt_crtc_t *crtc1,
+ igt_output_t *output1, igt_crtc_t *crtc2,
+ igt_output_t *output2)
{
struct igt_fb fb, fbs[2];
drmModeModeInfo *mode[2];
@@ -88,18 +88,18 @@ static void run_extendedmode_basic(data_t *data,
igt_display_reset(display);

igt_output_set_crtc(output1,
- igt_crtc_for_pipe(display, pipe1));
+ crtc1);
igt_output_set_crtc(output2,
- igt_crtc_for_pipe(display, pipe2));
+ crtc2);

mode[0] = igt_output_get_mode(output1);
mode[1] = igt_output_get_mode(output2);

igt_assert_f(igt_fit_modes_in_bw(display), "Unable to fit modes in bw\n");

- pipe_crc[0] = igt_crtc_crc_new(igt_crtc_for_pipe(display, pipe1),
+ pipe_crc[0] = igt_crtc_crc_new(crtc1,
IGT_PIPE_CRC_SOURCE_AUTO);
- pipe_crc[1] = igt_crtc_crc_new(igt_crtc_for_pipe(display, pipe2),
+ pipe_crc[1] = igt_crtc_crc_new(crtc2,
IGT_PIPE_CRC_SOURCE_AUTO);

igt_create_color_fb(data->drm_fd, mode[0]->hdisplay, mode[0]->vdisplay,
@@ -107,9 +107,9 @@ static void run_extendedmode_basic(data_t *data,
igt_create_color_fb(data->drm_fd, mode[1]->hdisplay, mode[1]->vdisplay,
DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, 0, 0, 1, &fbs[1]);

- plane[0] = igt_crtc_get_plane_type(igt_crtc_for_pipe(display, pipe1),
+ plane[0] = igt_crtc_get_plane_type(crtc1,
DRM_PLANE_TYPE_PRIMARY);
- plane[1] = igt_crtc_get_plane_type(igt_crtc_for_pipe(display, pipe2),
+ plane[1] = igt_crtc_get_plane_type(crtc2,
DRM_PLANE_TYPE_PRIMARY);

igt_plane_set_fb(plane[0], &fbs[0]);
@@ -163,10 +163,10 @@ static void run_extendedmode_basic(data_t *data,
igt_output_set_crtc(output1, NULL);
igt_output_set_crtc(output2, NULL);

- igt_plane_set_fb(igt_crtc_get_plane_type(igt_crtc_for_pipe(display, pipe1),
+ igt_plane_set_fb(igt_crtc_get_plane_type(crtc1,
DRM_PLANE_TYPE_PRIMARY),
NULL);
- igt_plane_set_fb(igt_crtc_get_plane_type(igt_crtc_for_pipe(display, pipe2),
+ igt_plane_set_fb(igt_crtc_get_plane_type(crtc2,
DRM_PLANE_TYPE_PRIMARY),
NULL);
igt_assert_f(igt_fit_modes_in_bw(display), "Unable to fit modes in bw\n");
@@ -224,10 +224,10 @@ static void run_extendedmode_test(data_t *data) {
igt_crtc_name(crtc2),
igt_output_name(output2))
run_extendedmode_basic(data,
- crtc->pipe,
- output1,
- crtc2->pipe,
- output2);
+ crtc,
+ output1,
+ crtc2,
+ output2);
}
}
/*
--
2.52.0