Re: [PATCH i-g-t v2 17/23] tests/intel/kms_psr: Use igt_crtc_t instead of enum pipe

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

On Sat, 21 Feb 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Convert kms_psr to use igt_crtc_t instead of enum pipe.
>
> The entire thing is about changing the return type of
> get_pipe_for_output().

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

>
> #include "scripts/iterators.cocci"
>
> @ret_pipe@
> typedef igt_output_t;
> typedef igt_crtc_t;
> identifier FUNC;
> igt_crtc_t *CRTC;
> parameter list[N] P;
> @@
> - enum pipe
> + igt_crtc_t *
> FUNC(P)
> {
> <...
> - return CRTC->pipe;
> + return CRTC;
> ...>
> }
>
> @depends on ret_pipe@
> identifier ret_pipe.FUNC;
> @@
> - enum pipe
> + igt_crtc_t *
> FUNC(...);
>
> @depends on ret_pipe@
> identifier ret_pipe.FUNC;
> @@
> FUNC(...)
> + ->pipe
>
> @depends on ret_pipe@
> identifier ret_pipe.FUNC, PIPE;
> expression list[ret_pipe.N] EP;
> @@
> { ...
> enum pipe PIPE;
> + igt_crtc_t *crtc;
> <+... when != PIPE = ...
> - PIPE = FUNC(EP)->pipe;
> + crtc = FUNC(EP);
> + PIPE = crtc->pipe;
> ...+>
> }
>
> @depends on ret_pipe@
> identifier ret_pipe.FUNC;
> expression list[ret_pipe.N] EP;
> @@
> - igt_crtc_for_pipe(..., FUNC(EP)->pipe)
> + FUNC(EP)
>
> @@
> identifier PIPE;
> igt_crtc_t *CRTC;
> @@
> {...
> - PIPE = CRTC->pipe;
> <+... when != PIPE = ...
> - PIPE
> + CRTC->pipe
> ...+>
> }
>
> @@
> igt_crtc_t *CRTC;
> @@
> - igt_crtc_for_pipe(..., CRTC->pipe)
> + CRTC
>
> @@
> identifier PIPE;
> @@
> {...
> - enum pipe PIPE;
> ... when != PIPE
> }
>
> @@
> typedef igt_display_t;
> identifier DISPLAY;
> @@
> - igt_display_t *DISPLAY = ...;
> ... when != DISPLAY
>
> v2: The last 'enum pipe' is now gone due to an earlier fix
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> tests/intel/kms_psr.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tests/intel/kms_psr.c b/tests/intel/kms_psr.c
> index c730a6f23944..0475e68d6bf5 100644
> --- a/tests/intel/kms_psr.c
> +++ b/tests/intel/kms_psr.c
> @@ -691,7 +691,7 @@ static void setup_test_plane(data_t *data, int test_plane)
> igt_display_commit(&data->display);
> }
>
> -static enum pipe get_pipe_for_output(igt_display_t *display,
> +static igt_crtc_t * get_pipe_for_output(igt_display_t *display,
> igt_output_t *output)
> {
> igt_crtc_t *crtc;
> @@ -705,7 +705,7 @@ static enum pipe get_pipe_for_output(igt_display_t *display,
> continue;
> }
>
> - return crtc->pipe;
> + return crtc;
> }
>
> igt_assert_f(false, "No pipe found for output %s\n",
> @@ -714,7 +714,7 @@ static enum pipe get_pipe_for_output(igt_display_t *display,
>
> static void test_setup(data_t *data)
> {
> - enum pipe pipe;
> + igt_crtc_t *crtc;
> drmModeConnectorPtr connector;
> bool psr_entered = false;
>
> @@ -729,7 +729,7 @@ static void test_setup(data_t *data)
> igt_require_f(data->fbc_flag,
> "Can't test FBC with PSR\n");
>
> - pipe = get_pipe_for_output(&data->display, data->output);
> + crtc = get_pipe_for_output(&data->display, data->output);
> data->crtc_id = data->output->config.crtc->crtc_id;
> connector = data->output->config.connector;
>
> @@ -750,7 +750,7 @@ static void test_setup(data_t *data)
> if (psr_wait_entry_if_enabled(data)) {
> if (data->fbc_flag == true && data->op_fbc_mode == FBC_ENABLED)
> igt_assert_f(intel_fbc_wait_until_enabled(data->drm_fd,
> - pipe),
> + crtc->pipe),
> "FBC still disabled\n");
> psr_entered = true;
> break;

--
Jani Nikula, Intel