From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 02/25] test/kms: Introduce a few extra format/modifier variables
Date: Tue, 12 May 2026 15:21:20 +0300 [thread overview]
Message-ID: <20260512122143.11013-3-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>
Reduce the number of places that directly index
plane->formats[] and plane->modifiers[] by storing the
results in local variables.
The plan is to introduce some abstractions around these
arrays, and thus having fewer places directly access the
arrays will reduce how many lines of code will need to
be touched.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/chamelium/kms_chamelium_frames.c | 41 ++++++++++++++------------
tests/intel/kms_flip_tiling.c | 19 +++++++-----
tests/kms_async_flips.c | 7 +++--
tests/kms_plane.c | 18 +++++++----
4 files changed, 50 insertions(+), 35 deletions(-)
diff --git a/tests/chamelium/kms_chamelium_frames.c b/tests/chamelium/kms_chamelium_frames.c
index efd9ff1b76e8..1cd3b34b9d65 100644
--- a/tests/chamelium/kms_chamelium_frames.c
+++ b/tests/chamelium/kms_chamelium_frames.c
@@ -307,10 +307,13 @@ static void randomize_plane_setup(chamelium_data_t *data, igt_plane_t *plane,
unsigned int i;
/* First pass to count the supported formats. */
- for (i = 0; i < plane->format_mod_count; i++)
- if (igt_fb_supported_format(plane->formats[i]) &&
- (allow_yuv || !igt_format_is_yuv(plane->formats[i])))
+ for (i = 0; i < plane->format_mod_count; i++) {
+ uint32_t f = plane->formats[i];
+
+ if (igt_fb_supported_format(f) &&
+ (allow_yuv || !igt_format_is_yuv(f)))
idx[count++] = i;
+ }
igt_assert(count > 0);
@@ -1039,23 +1042,23 @@ int igt_main()
igt_assert(primary);
for (k = 0; k < primary->format_mod_count; k++) {
- if (!igt_fb_supported_format(
- primary->formats[k]))
+ uint32_t format = primary->formats[k];
+ uint64_t modifier = primary->modifiers[k];
+
+ if (!igt_fb_supported_format(format))
continue;
- if (igt_format_is_yuv(primary->formats[k]))
+ if (igt_format_is_yuv(format))
continue;
- if (primary->modifiers[k] !=
- DRM_FORMAT_MOD_LINEAR)
+ if (modifier != DRM_FORMAT_MOD_LINEAR)
continue;
igt_dynamic_f(
"%s",
- igt_format_str(primary->formats[k]))
+ igt_format_str(format))
test_display_one_mode(
- &data, port,
- primary->formats[k],
+ &data, port, format,
CHAMELIUM_CHECK_CRC, 1);
}
}
@@ -1078,23 +1081,23 @@ int igt_main()
igt_assert(primary);
for (k = 0; k < primary->format_mod_count; k++) {
- if (!igt_fb_supported_format(
- primary->formats[k]))
+ uint32_t format = primary->formats[k];
+ uint64_t modifier = primary->modifiers[k];
+
+ if (!igt_fb_supported_format(format))
continue;
- if (!igt_format_is_yuv(primary->formats[k]))
+ if (!igt_format_is_yuv(format))
continue;
- if (primary->modifiers[k] !=
- DRM_FORMAT_MOD_LINEAR)
+ if (modifier != DRM_FORMAT_MOD_LINEAR)
continue;
igt_dynamic_f(
"%s",
- igt_format_str(primary->formats[k]))
+ igt_format_str(format))
test_display_one_mode(
- &data, port,
- primary->formats[k],
+ &data, port, format,
CHAMELIUM_CHECK_CHECKERBOARD,
1);
}
diff --git a/tests/intel/kms_flip_tiling.c b/tests/intel/kms_flip_tiling.c
index b732cd55cce7..14cc68c3b890 100644
--- a/tests/intel/kms_flip_tiling.c
+++ b/tests/intel/kms_flip_tiling.c
@@ -230,6 +230,8 @@ int igt_main()
bool run_in_simulation = igt_run_in_simulation();
for_each_crtc_with_valid_output(&data.display, crtc, output) {
+ uint32_t format[2];
+ uint64_t modifier[2];
igt_plane_t *plane;
igt_display_reset(&data.display);
@@ -243,21 +245,22 @@ int igt_main()
plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
for (int i = 0; i < plane->format_mod_count; i++) {
- if (plane->formats[i] != data.testformat)
+ format[0] = plane->formats[i];
+ modifier[0] = plane->modifiers[i];
+
+ if (format[0] != data.testformat)
continue;
for (int j = 0; j < plane->format_mod_count; j++) {
- uint64_t modifier[2] = {
- plane->modifiers[i],
- plane->modifiers[j],
- };
+ format[1] = plane->formats[j];
+ modifier[1] = plane->modifiers[j];
- if (plane->formats[j] != data.testformat)
+ if (format[1] != data.testformat)
continue;
if (run_in_simulation &&
- (!is_basic_tiling_modifier(plane->modifiers[i]) ||
- !is_basic_tiling_modifier(plane->modifiers[j])))
+ (!is_basic_tiling_modifier(modifier[0]) ||
+ !is_basic_tiling_modifier(modifier[1])))
continue;
igt_dynamic_f("pipe-%s-%s-%s-to-%s",
diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 2c39574a079b..61cebf3ba6fe 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -877,7 +877,9 @@ static void require_linear_modifier(data_t *data)
}
for (int i = 0; i < data->plane->async_format_mod_count; i++) {
- if (data->plane->async_modifiers[i] == DRM_FORMAT_MOD_LINEAR) {
+ uint64_t modifier = data->plane->async_modifiers[i];
+
+ if (modifier == DRM_FORMAT_MOD_LINEAR) {
data->modifier = DRM_FORMAT_MOD_LINEAR;
return;
}
@@ -1025,8 +1027,9 @@ static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
for (int i = 0; i < data->plane->async_format_mod_count; i++) {
uint64_t modifier = data->plane->async_modifiers[i];
+ uint32_t format = data->plane->async_formats[i];
- if (data->plane->async_formats[i] != DRM_FORMAT_XRGB8888)
+ if (format != DRM_FORMAT_XRGB8888)
continue;
if (modifier == DRM_FORMAT_MOD_LINEAR)
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 7962c733a671..0e00db014426 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -1127,7 +1127,9 @@ static void test_format_plane(data_t *data, igt_crtc_t *crtc,
bool found = false;
for (int i = 0; i < plane->format_mod_count; i++) {
- if (data->mod == plane->modifiers[i]) {
+ uint64_t modifier = plane->modifiers[i];
+
+ if (data->mod == modifier) {
found = true;
break;
}
@@ -1191,9 +1193,11 @@ static void test_format_plane(data_t *data, igt_crtc_t *crtc,
igt_require(num_unique_crcs(ref_crc[MULTIPLE_CRC_SET], data->num_colors) > 1);
for (int i = 0; i < plane->format_mod_count; i++) {
+ uint32_t format = plane->formats[i];
+ uint64_t modifier = plane->modifiers[i];
struct format_mod f = {
- .format = plane->formats[i],
- .modifier = plane->modifiers[i],
+ .format = format,
+ .modifier = modifier,
};
if (data->mod != f.modifier)
@@ -1261,9 +1265,11 @@ static bool skip_plane(data_t *data, igt_plane_t *plane)
int i;
for (i = 0; i < plane->format_mod_count; i++) {
- if (IS_AMD_FMT_MOD(plane->modifiers[i]) &&
- (AMD_FMT_MOD_GET(DCC, plane->modifiers[i]) ||
- AMD_FMT_MOD_GET(DCC_RETILE, plane->modifiers[i]))) {
+ uint64_t modifier = plane->modifiers[i];
+
+ if (IS_AMD_FMT_MOD(modifier) &&
+ (AMD_FMT_MOD_GET(DCC, modifier) ||
+ AMD_FMT_MOD_GET(DCC_RETILE, modifier))) {
igt_debug("Skipping planes with DCC or DCC_RETILE\n");
return true;
}
--
2.52.0
next prev parent reply other threads:[~2026-05-12 12:22 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 ` Ville Syrjala [this message]
2026-05-13 5:17 ` [PATCH i-g-t 02/25] test/kms: Introduce a few extra format/modifier variables 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 ` [PATCH i-g-t 04/25] lib/kms: Pass struct igt_format_mods to igt_parse_format_mod_blob() Ville Syrjala
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-3-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.