Re: [PATCH i-g-t v2 16/23] tests/kms_tiled_display: Use igt_crtc_t instead of enum pipe

Jani Nikula
2026-02-24T13:49:04Z

On Sat, 21 Feb 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Convert kms_tiled_display from 'enum pipe' to 'igt_crtc_t'.
>
> The data.pipe member gets directly replaced with data.crtc.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

>
> #include "scripts/iterators.cocci"
>
> @find_data@
> typedef igt_crtc_t;
> typedef igt_display_t;
> identifier PIPE;
> type T;
> @@
> T {
> ...
> - enum pipe PIPE;
> + igt_crtc_t *crtc;
> ...
> };
>
> @depends on find_data@
> identifier find_data.PIPE;
> identifier DISPLAY;
> find_data.T S;
> find_data.T *P;
> expression _PIPE;
> @@
> igt_display_t *DISPLAY = ...;
> <...
> (
> - S.PIPE = _PIPE;
> + S.crtc = igt_crtc_for_pipe(display, _PIPE);
> |
> - P->PIPE = _PIPE;
> + P->crtc = igt_crtc_for_pipe(display, _PIPE);
> )
> ...>
>
> @depends on find_data@
> identifier find_data.PIPE;
> identifier DISPLAY;
> find_data.T S;
> find_data.T *P;
> expression E;
> @@
> igt_display_t *DISPLAY = ...;
> <...
> (
> - S.PIPE = E
> + S.crtc = igt_crtc_for_pipe(DISPLAY, E)
> |
> - P->PIPE = E
> + P->crtc = igt_crtc_for_pipe(DISPLAY, E)
> )
> ...>
>
> @depends on find_data@
> identifier find_data.PIPE;
> find_data.T S;
> find_data.T *P;
> expression E;
> @@
> (
> - igt_crtc_for_pipe(..., S.PIPE)
> + S.crtc
> |
> - igt_crtc_for_pipe(..., P->PIPE)
> + P->crtc
> |
> - kmstest_pipe_name(S.PIPE)
> + igt_crtc_name(S.crtc)
> |
> - kmstest_pipe_name(P->PIPE)
> + igt_crtc_name(P->crtc)
> )
>
> @depends on find_data@
> find_data.T S;
> find_data.T *P;
> @@
> (
> - S.crtc = S.crtc;
> |
> - P->crtc = P->crtc;
> )
>
> @depends on find_data@
> identifier find_data.PIPE;
> find_data.T S;
> find_data.T *P;
> @@
> (
> - S.PIPE
> + S.crtc->pipe
> |
> - P->PIPE
> + P->crtc->pipe
> )
>
> @depends on find_data@
> find_data.T S;
> find_data.T *P;
> binary operator OP = { ==, != };
> @@
> (
> - S.crtc->pipe OP PIPE_NONE
> + S.crtc OP NULL
> |
> - P->crtc->pipe OP PIPE_NONE
> + P->crtc OP NULL
> )
>
> @@
> igt_crtc_t *CRTC;
> @@
> - igt_crtc_for_pipe(..., CRTC->pipe)
> + CRTC
>
> @@
> typedef igt_display_t;
> identifier DISPLAY;
> @@
> - igt_display_t *DISPLAY = ...;
> ... when != DISPLAY
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> tests/kms_tiled_display.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/tests/kms_tiled_display.c b/tests/kms_tiled_display.c
> index f587704eebe1..374ea0bf6a85 100644
> --- a/tests/kms_tiled_display.c
> +++ b/tests/kms_tiled_display.c
> @@ -65,7 +65,7 @@ IGT_TEST_DESCRIPTION("Test for genlocked CRTCs with tiled displays");
> typedef struct {
> igt_output_t *output;
> igt_tile_info_t tile;
> - enum pipe pipe;
> + igt_crtc_t *crtc;
> drmModeConnectorPtr connector;
> bool got_page_flip;
> } data_connector_t;
> @@ -213,7 +213,6 @@ static int mode_linetime_us(const drmModeModeInfo *mode)
>
> static void setup_mode(data_t *data)
> {
> - igt_display_t *display = &data->display;
> int count = 0, prev = 0, i = 0;
> bool pipe_in_use = false, found = false;
> igt_crtc_t *crtc;
> @@ -238,7 +237,7 @@ static void setup_mode(data_t *data)
>
> if (count > 0) {
> for (prev = count - 1; prev >= 0; prev--) {
> - if (crtc->pipe == conns[prev].pipe) {
> + if (crtc->pipe == conns[prev].crtc->pipe) {
> pipe_in_use = true;
> break;
> }
> @@ -248,15 +247,15 @@ static void setup_mode(data_t *data)
> }
>
> if (igt_pipe_connector_valid(crtc->pipe, output)) {
> - conns[count].pipe = crtc->pipe;
> + conns[count].crtc = crtc;
> conns[count].output = output;
>
> igt_output_set_crtc(conns[count].output,
> - igt_crtc_for_pipe(display, conns[count].pipe));
> + conns[count].crtc);
> break;
> }
> }
> - igt_require(conns[count].pipe != PIPE_NONE);
> + igt_require(conns[count].crtc != NULL);
>
> for (i = 0; i < conns[count].connector->count_modes; i++) {
> mode = &conns[count].connector->modes[i];
> @@ -326,11 +325,10 @@ static void setup_framebuffer(data_t *data)
>
> static data_connector_t *conn_for_crtc(data_t *data, unsigned int crtc_id)
> {
> - igt_display_t *display = &data->display;
> for (int i = 0; i < data->num_h_tiles; i++) {
> data_connector_t *conn = &data->conns[i];
>
> - if (igt_crtc_for_pipe(display, conn->pipe)->crtc_id == crtc_id)
> + if (conn->crtc->crtc_id == crtc_id)
> return conn;
> }

--
Jani Nikula, Intel