All of lore.kernel.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 04/25] lib/kms: Pass struct igt_format_mods to igt_parse_format_mod_blob()
Date: Tue, 12 May 2026 15:21:22 +0300	[thread overview]
Message-ID: <20260512122143.11013-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260512122143.11013-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Pass the entire format_mods struct to igt_parse_format_mod_blob()
instead of of the individual pieces. Not as messy and fragile as
the current approach.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_kms.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index b60bfa033bcd..6b42c50e9273 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6183,34 +6183,36 @@ static int igt_count_plane_format_mod(const struct drm_format_modifier_blob *blo
 }
 
 static void igt_parse_format_mod_blob(const struct drm_format_modifier_blob *blob_data,
-				      uint32_t **formats, uint64_t **modifiers, int *count)
+				      struct igt_format_mods *format_mods)
 {
 	const struct drm_format_modifier *m = modifiers_ptr(blob_data);
 	const uint32_t *f = formats_ptr(blob_data);
 	int idx = 0;
 
-	*count = igt_count_plane_format_mod(blob_data);
-	if (*count == 0)
+	format_mods->count = igt_count_plane_format_mod(blob_data);
+	if (format_mods->count == 0)
 		return;
 
-	*formats = calloc(*count, sizeof((*formats)[0]));
-	igt_assert(*formats);
-	*modifiers = calloc(*count, sizeof((*modifiers)[0]));
-	igt_assert(*modifiers);
+	format_mods->formats = calloc(format_mods->count,
+				       sizeof((format_mods->formats)[0]));
+	igt_assert(format_mods->formats);
+	format_mods->modifiers = calloc(format_mods->count,
+					 sizeof((format_mods->modifiers)[0]));
+	igt_assert(format_mods->modifiers);
 
 	for (int i = 0; i < blob_data->count_modifiers; i++) {
 		for (int j = 0; j < 64; j++) {
 			if (!(m[i].formats & (1ULL << j)))
 				continue;
 
-			(*formats)[idx] = f[m[i].offset + j];
-			(*modifiers)[idx] = m[i].modifier;
+			format_mods->formats[idx] = f[m[i].offset + j];
+			format_mods->modifiers[idx] = m[i].modifier;
 			idx++;
-			igt_assert_lte(idx, *count);
+			igt_assert_lte(idx, format_mods->count);
 		}
 	}
 
-	igt_assert_eq(idx, *count);
+	igt_assert_eq(idx, format_mods->count);
 }
 
 static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane)
@@ -6249,7 +6251,7 @@ static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane
 		return;
 
 	blob_data = (const struct drm_format_modifier_blob *)blob->data;
-	igt_parse_format_mod_blob(blob_data, &plane->format_mods.formats, &plane->format_mods.modifiers, &plane->format_mods.count);
+	igt_parse_format_mod_blob(blob_data, &plane->format_mods);
 	drmModeFreePropertyBlob(blob);
 
 	if (igt_plane_has_prop(plane, IGT_PLANE_IN_FORMATS_ASYNC)) {
@@ -6259,7 +6261,7 @@ static void igt_fill_plane_format_mod(igt_display_t *display, igt_plane_t *plane
 			return;
 
 		blob_data = (const struct drm_format_modifier_blob *)blob->data;
-		igt_parse_format_mod_blob(blob_data, &plane->format_mods_async.formats, &plane->format_mods_async.modifiers, &plane->format_mods_async.count);
+		igt_parse_format_mod_blob(blob_data, &plane->format_mods_async);
 		drmModeFreePropertyBlob(blob);
 	}
 }
-- 
2.52.0


  parent reply	other threads:[~2026-05-12 12:23 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 12:21 [PATCH i-g-t 00/25] lib/kms: Clean up format+mod stuff Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 01/25] tests/kms_async_flips: Use correct format_mod list Ville Syrjala
2026-05-13  5:12   ` B, Jeevan
2026-05-12 12:21 ` [PATCH i-g-t 02/25] test/kms: Introduce a few extra format/modifier variables Ville Syrjala
2026-05-13  5:17   ` B, Jeevan
2026-05-12 12:21 ` [PATCH i-g-t 03/25] lib/kms: Introduce struct igt_format_mods Ville Syrjala
2026-05-13  5:23   ` B, Jeevan
2026-05-12 12:21 ` Ville Syrjala [this message]
2026-05-12 12:21 ` [PATCH i-g-t 05/25] lib/kms: Extract format_mods_alloc() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 06/25] lib/kms: Extract fill_plane_default_format_mods() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 07/25] lib/kms: Extract igt_format_mods_has_format_with_modifier() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 08/25] lib/kms: Pass target format_mods to igt_add_display_format_mod() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 09/25] lib/kms: Extract format_mods_union() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 10/25] lib/kms: Extract display_format_mods_union() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 11/25] lib/kms: Move and rename igt_count_display_format_mod() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 12/25] lib/kms: Make igt_fill_display_format_mod() more flexible Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 13/25] lib/kms: Add display->format_mods_async Ville Syrjala
2026-05-14  4:35   ` Reddy Guddati, Santhosh
2026-05-12 12:21 ` [PATCH i-g-t 14/25] lib/kms: Fill plane->format_mods_async for planes without IN_FORMATS Ville Syrjala
2026-05-14  4:59   ` Reddy Guddati, Santhosh
2026-05-12 12:21 ` [PATCH i-g-t 15/25] lib/kms: Encourage drivers to expose IN_FORMATS_ASYNC Ville Syrjala
2026-05-14  5:15   ` Reddy Guddati, Santhosh
2026-05-12 12:21 ` [PATCH i-g-t 16/25] lib/kms: Introduce igt_format_mods iterators Ville Syrjala
2026-05-13  3:17   ` [PATCH i-g-t v2 " Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 17/25] lib/kms: Add helpers to query igt_format_mods Ville Syrjala
2026-05-13  3:17   ` [PATCH i-g-t v2 " Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 18/25] tests/chamelium/kms_chamelium_frames: Use for_each_format_and_modifier() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 19/25] tests/kms_plane: Use igt_format_mods_has_modifier() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 20/25] tests/kms_plane: Use for_each_format_and_modifier() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 21/25] tests/kms_async_flips: Remove the IN_FORMAT_ASYNC check Ville Syrjala
2026-05-14  5:18   ` Reddy Guddati, Santhosh
2026-05-12 12:21 ` [PATCH i-g-t 22/25] tests/kms_async_flips: Use igt_format_mods_has_modifier() Ville Syrjala
2026-05-14  4:27   ` Reddy Guddati, Santhosh
2026-05-12 12:21 ` [PATCH i-g-t 23/25] tests/kms_async_flips: Use for_each_format_and_modifier() and for_each_modifier_with_format() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 24/25] tests/intel/kms_flip_tiling: Use for_each_modifier_with_format() Ville Syrjala
2026-05-12 12:21 ` [PATCH i-g-t 25/25] tests/chamelium/kms_chamelium_frames: Use for_each_format_with_modifier() Ville Syrjala
2026-05-12 22:00 ` ✗ i915.CI.BAT: failure for lib/kms: Clean up format+mod stuff Patchwork
2026-05-13  0:10 ` ✗ Xe.CI.BAT: " Patchwork
2026-05-13  4:25 ` ✓ i915.CI.BAT: success for lib/kms: Clean up format+mod stuff (rev3) Patchwork
2026-05-13  4:34 ` ✓ Xe.CI.BAT: " Patchwork
2026-05-13 17:00 ` ✗ Xe.CI.FULL: failure for lib/kms: Clean up format+mod stuff Patchwork
2026-05-14  0:12 ` ✗ Xe.CI.FULL: failure for lib/kms: Clean up format+mod stuff (rev3) Patchwork
2026-05-14  2:27 ` ✗ i915.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=20260512122143.11013-5-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 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.