public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/3] lib/kms: Introduce for_each_plane_format()
@ 2026-04-16 14:13 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
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Ville Syrjala @ 2026-04-16 14:13 UTC (permalink / raw)
  To: igt-dev

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-04-17  1:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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ä
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox