Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 01/15] lib/kms: Introduce for_each_crtc*()
Date: Mon, 2 Feb 2026 17:31:32 +0200	[thread overview]
Message-ID: <aYDDVPwt1zZd7478@intel.com> (raw)
In-Reply-To: <70db2072688f084cff3321a97b02ac561a1eeb0e@intel.com>

On Mon, Feb 02, 2026 at 01:10:35PM +0200, Jani Nikula wrote:
> On Fri, 30 Jan 2026, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > On Fri, Jan 30, 2026 at 03:38:03PM +0200, Jani Nikula wrote:
> >> On Fri, 30 Jan 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> >> > +/**
> >> > + * for_each_crtc:
> >> > + * @display: a pointer to an #igt_display_t structure
> >> > + * @crtc: The CRTC
> >> > + *
> >> > + * This for loop iterates over all CRTCs.
> >> > + *
> >> > + * Note that this cannot be used to enumerate per-CRTC subtest names since it
> >> > + * depends upon runtime probing of the actual kms driver that is being tested.
> >> > + * Use #for_each_pipe_static instead.
> >> > + */
> >> > +#define for_each_crtc(display, crtc) \
> >> > +	for ((crtc) = &(display)->crtcs[0]; \
> >> > +	     (crtc) < &(display)->crtcs[(display)->n_crtcs]; \
> >> > +	     (crtc)++) \
> >> > +		for_each_if ((crtc)->valid)
> >> 
> >> I feel like for_each_crtc() should iterate the CRTCs in CRTC order, not
> >> pipe order. What's the plan? Are we eventually going to have ->crtcs[]
> >> in CRTC order?
> >
> > I don't even know what it means to have them in pipe order. It should be
> > one and the same right now because the kernel anyway has them in the
> > same order. I guess it just means we could theoeretically have holes
> > in the array with crtc->valid==false for fused off pipes?
> >
> > But yeah, if/when we start to reorder the pipes, I think we should keep
> > this stuff in CRTC order, and get rid of the holes.
> 
> In igt_display_require(), the loop is:
> 
> 	for (i = 0; i < resources->count_crtcs; i++) {
> 		igt_crtc_t *crtc;
> 		int pipe_enum = is_intel_dev ? __intel_get_pipe_from_crtc_index(drm_fd, i) : i;
> 
> 		crtc = igt_crtc_for_pipe(display, pipe_enum);
> 		crtc->pipe = pipe_enum;
> 
> 		crtc->valid = true;
> 		crtc->crtc_id = resources->crtcs[i];
> 		/* offset of a pipe in crtcs list */
> 		crtc->crtc_offset = i;
> 	}
> 
> And igt_crtc_for_pipe() returns &display->crtcs[pipe] i.e. the
> display->crtcs is currently in pipe order, and it could have holes if
> pipes have been fused off.
> 
> Feels like this is so convoluted all over the place that we'd be better
> off resetting everything back to assuming pipe === crtc index, and
> fixing stuff from ground up. :/

Yeah, pretty much.

I guess once the bigger cocci stuff is done we should do something
like:
- leave most crtc->pipe vs. PIPE_<whatever> checks alone as those
  are probably looking for a specific hardware pipe
- most other crtc->pipe usages should just be converted to
  crtc_index instead

That could perhaps be done with cocci as well.

And then we can start cleaning igt_kms itself:
- make display->crtcs[] keep the kernel crtc order and get rid of
  the holes, and have igt_crtc_for_pipe() just search through the
  array for the right crtc
- change all the pending_pipe/valid_crtc_idx_mask/etc. stuff to use
  igt_crtc_t or crtc_index
- etc.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2026-02-02 15:31 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30 10:52 [PATCH i-g-t 00/15] lib/kms: Start introducing for_each_crtc*() Ville Syrjala
2026-01-30 10:52 ` [PATCH i-g-t 01/15] lib/kms: Introduce for_each_crtc*() Ville Syrjala
2026-01-30 13:38   ` Jani Nikula
2026-01-30 15:36     ` Ville Syrjälä
2026-02-02 11:10       ` Jani Nikula
2026-02-02 15:31         ` Ville Syrjälä [this message]
2026-01-30 10:52 ` [PATCH i-g-t 02/15] tests/drm_read: Use for_each_crtc*() Ville Syrjala
2026-01-30 13:39   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 03/15] tests/kms_plane_scaling: " Ville Syrjala
2026-01-30 12:03   ` Jani Nikula
2026-01-30 15:41     ` Ville Syrjälä
2026-02-02 11:04       ` Jani Nikula
2026-01-30 14:07   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 04/15] tests/kms_color: Convert to for_each_crtc*() Ville Syrjala
2026-01-30 14:08   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 05/15] tests/intel/kms_pm_dc: Use for_each_crtc*() Ville Syrjala
2026-01-30 14:10   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 06/15] tests/kms_rotation_crc: " Ville Syrjala
2026-01-30 14:11   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 07/15] lib/kms: Use for_each_crtc_with_single_output() and for_each_crtc() Ville Syrjala
2026-01-30 14:15   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 08/15] lib/kms: Use for_each_crtc_with_single_output(), part 1 Ville Syrjala
2026-01-30 14:16   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 09/15] lib/kms: Use for_each_crtc_with_single_output(), part 2 Ville Syrjala
2026-01-30 14:19   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 10/15] lib/kms: Use for_each_crtc_with_single_output(), part 3 Ville Syrjala
2026-01-30 14:22   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 11/15] lib/kms: Use for_each_crtc_with_valid_output(), part 1 Ville Syrjala
2026-01-30 14:24   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 12/15] lib/kms: Use for_each_crtc_with_valid_output(), part 2 Ville Syrjala
2026-01-30 14:26   ` Jani Nikula
2026-02-02 15:38     ` [PATCH i-g-t v2 " Ville Syrjala
2026-01-30 10:52 ` [PATCH i-g-t 13/15] lib/kms: Use for_each_crtc_with_valid_output(), part 3 Ville Syrjala
2026-01-30 14:27   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 14/15] lib/kms: Use for_each_crtc_with_valid_output(), part 4 Ville Syrjala
2026-01-30 14:30   ` Jani Nikula
2026-01-30 10:52 ` [PATCH i-g-t 15/15] lib/kms: Nuke for_each_pipe_with_*_output() Ville Syrjala
2026-01-30 14:35   ` Jani Nikula
2026-02-03  2:58 ` ✓ i915.CI.BAT: success for lib/kms: Start introducing for_each_crtc*() (rev2) Patchwork
2026-02-03  3:12 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-03 13:48 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-03 14:33 ` ✗ 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=aYDDVPwt1zZd7478@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@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