igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 08/10] lib/kms: Introduce igt_output_set_crtc()
Date: Wed, 10 Dec 2025 16:34:58 +0200	[thread overview]
Message-ID: <d1e219d0430f467035ee6ff53cdebba072d85695@intel.com> (raw)
In-Reply-To: <20251210093903.15934-9-ville.syrjala@linux.intel.com>

On Wed, 10 Dec 2025, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Introduce igt_output_set_crtc() as the intended replacement for
> igt_output_set_pipe().
>
> One step towards using 'crtcs' instead of 'pipes'.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  lib/igt_kms.c | 44 +++++++++++++++++++++++++++++++-------------
>  lib/igt_kms.h |  1 +
>  2 files changed, 32 insertions(+), 13 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 3b71cee61635..40c521b3a331 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -5277,31 +5277,35 @@ int igt_output_preferred_vrefresh(igt_output_t *output)
>  		return 60;
>  }
>  
> +static const char *igt_crtc_name(igt_pipe_t *crtc)
> +{
> +	if (crtc == NULL)
> +		return "None";
> +
> +	return kmstest_pipe_name(crtc->pipe);
> +}
> +
>  /**
> - * igt_output_set_pipe:
> + * igt_output_set_crtc:
>   * @output: Target output for which the pipe is being set to
> - * @pipe: Display pipe to set to
> + * @pipe_obj: CRTC to set to
>   *
> - * This function sets a @pipe to a specific @output connector by
> - * setting the CRTC_ID property of the @pipe. The pipe
> - * is only activated for all pipes except PIPE_NONE.
> + * This function sets a @crtc to a specific @output connector by
> + * setting the CRTC_ID property of the @crtc.
>   */
> -void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
> +void igt_output_set_crtc(igt_output_t *output, igt_pipe_t *pipe_obj)
>  {
>  	igt_display_t *display = output->display;
> -	igt_pipe_t *old_pipe = NULL, *pipe_obj = NULL;;
> +	igt_pipe_t *old_pipe = NULL;
>  
>  	igt_assert(output->name);
>  
>  	if (output->pending_pipe != PIPE_NONE)
>  		old_pipe = igt_output_get_driving_pipe(output);
>  
> -	if (pipe != PIPE_NONE)
> -		pipe_obj = igt_crtc_for_pipe(display, pipe);
> -
>  	LOG(display, "%s: set_pipe(%s)\n", igt_output_name(output),
> -	    kmstest_pipe_name(pipe));
> -	output->pending_pipe = pipe;
> +	    igt_crtc_name(pipe_obj));
> +	output->pending_pipe = pipe_obj ? pipe_obj->pipe : PIPE_NONE;
>  
>  	if (old_pipe) {
>  		igt_output_t *old_output;
> @@ -5318,7 +5322,7 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
>  	}
>  
>  	igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID,
> -				  pipe == PIPE_NONE ? 0 : igt_crtc_for_pipe(display, pipe)->crtc_id);
> +				  pipe_obj ? pipe_obj->crtc_id : 0);
>  
>  	igt_output_refresh(output);
>  
> @@ -5332,6 +5336,20 @@ void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
>  	}
>  }
>  
> +/**
> + * igt_output_set_pipe:
> + * @output: Target output for which the pipe is being set to
> + * @pipe_obj: Display pipe to set to
> + *
> + * This function sets a @pipe to a specific @output connector by
> + * setting the CRTC_ID property of the @pipe. The pipe
> + * is only activated for all pipes except PIPE_NONE.
> + */
> +void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
> +{
> +	igt_output_set_crtc(output, igt_crtc_for_pipe(output->display, pipe));

How does that work for the igt_output_set_pipe(output, PIPE_NONE) calls?
Seems like the idea was to pass NULL here? Or should igt_crtc_for_pipe()
handle PIPE_NONE and return NULL?

> +}
> +
>  static
>  bool __override_all_active_output_modes_to_fit_bw(igt_display_t *display,
>  						  igt_output_t *outputs[IGT_MAX_PIPES],
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index a9d2d9027ae8..9ec0f08ada24 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -589,6 +589,7 @@ drmModeModeInfo *igt_output_get_highres_mode(igt_output_t *output);
>  drmModeModeInfo *igt_output_get_lowres_mode(igt_output_t *output);
>  void igt_output_override_mode(igt_output_t *output, const drmModeModeInfo *mode);
>  int igt_output_preferred_vrefresh(igt_output_t *output);
> +void igt_output_set_crtc(igt_output_t *output, igt_pipe_t *pipe_obj);
>  void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
>  igt_plane_t *igt_output_get_plane(igt_output_t *output, int plane_idx);
>  igt_plane_t *igt_output_get_plane_type(igt_output_t *output, int plane_type);

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-12-10 14:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10  9:38 [PATCH i-g-t 00/10] lib/kms: Move towards using 'crtcs' instead of 'pipes' Ville Syrjala
2025-12-10  9:38 ` [PATCH i-g-t 01/10] tests/intel/kms_dp_linktrain_fallback: Reduce side effects in igt_output_set_pipe() args Ville Syrjala
2025-12-10 14:21   ` Jani Nikula
2025-12-10  9:38 ` [PATCH i-g-t 02/10] lib/kms: Introduce igt_display_n_crtcs() Ville Syrjala
2025-12-10 14:21   ` Jani Nikula
2025-12-10  9:38 ` [PATCH i-g-t 03/10] lib/kms: Use igt_display_n_crtcs() everywhere Ville Syrjala
2025-12-10 14:22   ` Jani Nikula
2025-12-10  9:38 ` [PATCH i-g-t 04/10] lib/kms: Introduce igt_crtc_for_pipe() Ville Syrjala
2025-12-10 14:23   ` Jani Nikula
2025-12-10 17:16   ` [PATCH i-g-t v2 " Ville Syrjala
2025-12-10  9:38 ` [PATCH i-g-t 05/10] lib/kms: Use igt_crtc_for_pipe() everywhere Ville Syrjala
2025-12-10 14:25   ` Jani Nikula
2025-12-12 15:32     ` Ville Syrjälä
2025-12-10  9:38 ` [PATCH i-g-t 06/10] lib/kms: Remove tall tales about 'pipe' in DRM_IOCTL_WAIT_VBLANK Ville Syrjala
2025-12-10 14:25   ` Jani Nikula
2025-12-10  9:39 ` [PATCH i-g-t 07/10] lib/kms: Pass the entire igt_pipe_t to igt_wait_for_vblank*() Ville Syrjala
2025-12-10 14:29   ` Jani Nikula
2025-12-10  9:39 ` [PATCH i-g-t 08/10] lib/kms: Introduce igt_output_set_crtc() Ville Syrjala
2025-12-10 14:34   ` Jani Nikula [this message]
2025-12-10 14:36     ` Jani Nikula
2025-12-10 14:38       ` Jani Nikula
2025-12-10 14:44         ` Jani Nikula
2025-12-10 14:48         ` Ville Syrjälä
2025-12-10  9:39 ` [PATCH i-g-t 09/10] lib/kms: Replace igt_output_set_pipe() with igt_output_set_crtc() Ville Syrjala
2025-12-10 14:42   ` Jani Nikula
2025-12-10  9:39 ` [PATCH i-g-t 10/10] lib/kms: Rename igt_pipe_t to igt_crtc_t Ville Syrjala
2025-12-10 14:43   ` Jani Nikula
2025-12-10 13:34 ` ✓ Xe.CI.BAT: success for lib/kms: Move towards using 'crtcs' instead of 'pipes' Patchwork
2025-12-10 14:12 ` ✗ i915.CI.BAT: failure " Patchwork
2025-12-10 19:49 ` ✗ Xe.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1e219d0430f467035ee6ff53cdebba072d85695@intel.com \
    --to=jani.nikula@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).