public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 1/3] lib/kms: Introduce for_each_plane_format()
Date: Thu, 16 Apr 2026 17:13:32 +0300	[thread overview]
Message-ID: <20260416141334.20086-1-ville.syrjala@linux.intel.com> (raw)

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))
+
 #define IGT_FIXED(i,f)	((i) << 16 | (f))
 
 /**
-- 
2.52.0


             reply	other threads:[~2026-04-16 14:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16 14:13 Ville Syrjala [this message]
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ä
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=20260416141334.20086-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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