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 1/3] lib/kms: Introduce for_each_plane_format()
Date: Thu, 16 Apr 2026 19:07:00 +0300 [thread overview]
Message-ID: <aeEJJNU-c1_pWjH8@intel.com> (raw)
In-Reply-To: <0883b9b3996df973ab8856363c77281ea51a079c@intel.com>
On Thu, Apr 16, 2026 at 06:44:05PM +0300, Jani Nikula wrote:
> On Thu, 16 Apr 2026, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > A few places want to iterate just the formats supported by a plane,
> > ignoring the modifier aspect entirely. Add a new iterator for this
> > (for_each_plane_format()) to avoid everyone just open coding it.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > lib/igt_kms.h | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> > index fcbb6a5ade3a..a58cb5cd3430 100644
> > --- a/lib/igt_kms.h
> > +++ b/lib/igt_kms.h
> > @@ -816,6 +816,18 @@ igt_output_crtc_t *__igt_output_crtc_populate(igt_display_t *display,
> > (mode) < &(output)->config.connector->modes[(output)->config.connector->count_modes]; \
> > (mode)++)
> >
> > +/**
> > + * for_each_plane_format:
> > + * @plane: a pointer to an #igt_plane_t structure
> > + * @format: format iterator
> > + *
> > + * This for loop iterates over all formats supported by @plane.
> > + */
> > +#define for_each_plane_format(plane, format) \
> > + for (int __i = 0; __i < (plane)->drm_plane->count_formats; __i++) \
> > + for_each_if (((format) = (plane)->drm_plane->formats[__i], \
> > + 1))
>
> Using kernel-style __UNIQUE_ID() for __i would be nice to have, but I
> guess we don't have that facility in IGT.
We do (igt_unique()), but I didn't actually need it here so
didn't bother with it. I do have some other iterators lined
up where I did need nested use, and so used it there. I suppose
using it here too might make sense, just in case someone does
come up with some nested use case.
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> > +
> > #define IGT_FIXED(i,f) ((i) << 16 | (f))
> >
> > /**
>
> --
> Jani Nikula, Intel
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2026-04-16 16:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 14:13 [PATCH i-g-t 1/3] lib/kms: Introduce for_each_plane_format() Ville Syrjala
2026-04-16 14:13 ` [PATCH i-g-t 2/3] lib/kms: Use for_each_plane_format() for the msm scaler counting Ville Syrjala
2026-04-16 15:47 ` Jani Nikula
2026-04-16 14:13 ` [PATCH i-g-t 3/3] tests/kms: Use for_each_plane_format() Ville Syrjala
2026-04-16 15:44 ` Jani Nikula
2026-04-16 15:44 ` [PATCH i-g-t 1/3] lib/kms: Introduce for_each_plane_format() Jani Nikula
2026-04-16 16:07 ` Ville Syrjälä [this message]
2026-04-16 22:39 ` ✓ i915.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2026-04-16 22:58 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-17 1:22 ` ✗ Xe.CI.FULL: failure " 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=aeEJJNU-c1_pWjH8@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.