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 04/10] lib/kms: Introduce igt_crtc_for_pipe()
Date: Wed, 10 Dec 2025 16:23:04 +0200	[thread overview]
Message-ID: <2c2ed62ecaa64c44c321a77b75a42a1eb7848cd7@intel.com> (raw)
In-Reply-To: <20251210093903.15934-5-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>
>
> Start weaning everyone off from poking inside display->pipes[]
> by hand. Introduce igt_crtc_for_pipe() as the preferred method
> for getting the correct crtc.
>
> Done by hand because this needs to be used in a few messy macros
> that cocci doesn't like.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  lib/igt_kms.h | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 6e7cf112b1e2..5bb5c2cac19c 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -578,6 +578,11 @@ void igt_display_require_output(igt_display_t *display);
>  void igt_display_require_output_on_pipe(igt_display_t *display, enum pipe pipe);
>  int igt_display_n_crtcs(igt_display_t *display);
>  
> +static inline igt_pipe_t *igt_crtc_for_pipe(igt_display_t *display, enum pipe pipe)
> +{
> +	return &display->pipes[pipe];
> +}
> +
>  const char *igt_output_name(igt_output_t *output);
>  drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
>  drmModeModeInfo *igt_output_get_highres_mode(igt_output_t *output);
> @@ -726,7 +731,7 @@ static inline bool igt_output_is_connected(igt_output_t *output)
>   */
>  #define for_each_pipe(display, pipe) \
>  	for_each_pipe_static(pipe) \
> -		for_each_if((display)->pipes[(pipe)].valid)
> +		for_each_if(igt_crtc_for_pipe((display), (pipe))->valid)
>  
>  /**
>   * for_each_pipe_with_valid_output:
> @@ -745,7 +750,7 @@ static inline bool igt_output_is_connected(igt_output_t *output)
>  	for (int con__ = (pipe) = 0; \
>  	     assert(igt_can_fail()), (pipe) < igt_display_n_crtcs(display) && con__ < (display)->n_outputs; \
>  	     con__ = (con__ + 1 < (display)->n_outputs) ? con__ + 1 : (pipe = pipe + 1, 0)) \
> -		 for_each_if((display)->pipes[pipe].valid) \
> +		for_each_if(igt_crtc_for_pipe((display), (pipe))->valid) \
>  			for_each_if ((((output) = &(display)->outputs[con__]), \
>  						igt_pipe_connector_valid((pipe), (output))))
>  
> @@ -793,8 +798,9 @@ igt_output_t **__igt_pipe_populate_outputs(igt_display_t *display,
>   * If there are no valid planes for this pipe, nothing happens.
>   */
>  #define for_each_plane_on_pipe(display, pipe, plane)			\
> -	for (int j__ = 0; assert(igt_can_fail()), (plane) = &(display)->pipes[(pipe)].planes[j__], \
> -		     j__ < (display)->pipes[(pipe)].n_planes; j__++)
> +	for (int j__ = 0; assert(igt_can_fail()), \
> +		     (plane) = &igt_crtc_for_pipe((display), (pipe))->planes[j__], \
> +		     j__ < igt_crtc_for_pipe((display), (pipe))->n_planes; j__++)
>  
>  /**
>   * for_each_connector_mode:

-- 
Jani Nikula, Intel

  reply	other threads:[~2025-12-10 14:23 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 [this message]
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
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=2c2ed62ecaa64c44c321a77b75a42a1eb7848cd7@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).