[PATCH i-g-t] tests/kms_async_flips: Replace hard coded modifiers with async modifiers

Santhosh Reddy Guddati santhosh.reddy.guddati at intel.com
Tue Jul 15 15:48:27 UTC 2025


Use the IN_FORMATS_ASYNC uAPI to get the list of async supported modifiers.
select the 2 unique modifiers from this list to test invalid async test,
removing the hard coded dependency across platforms.

closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3768
Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
---
 tests/kms_async_flips.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index ddac904ce..ed95ffc96 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -598,6 +598,7 @@ static void test_invalid(data_t *data)
 	struct igt_fb fb[2];
 	drmModeModeInfo *mode;
 	int flags;
+	uint64_t mod1, mod2, found;
 
 	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
@@ -607,10 +608,35 @@ static void test_invalid(data_t *data)
 
 	flags = DRM_MODE_PAGE_FLIP_ASYNC | DRM_MODE_PAGE_FLIP_EVENT;
 
+	/*
+	 * TODO: As the async supported modifiers are currently duplicated in the list,
+	 * the below approach is chosen to find unique modifiers.
+	 * Get the first two supported async modifiers for the current plane.
+	 */
+	mod1 = 0;
+	mod2 = 0;
+	found = 0;
+	for (int i = 0; i < data->plane->async_format_mod_count && found < 2; i++) {
+		uint64_t mod = data->plane->async_modifiers[i];
+
+		if (mod1 == 0) {
+			mod1 = mod;
+			found = 1;
+		} else if (mod != mod1) {
+			mod2 = mod;
+			found = 2;
+			break;
+		}
+	}
+
+	igt_require_f(found == 2, "Need at least two distinct async modifiers for this test\n");
+
+	igt_debug("mod1 = %s, mod2 = %s\n", igt_fb_modifier_name(mod1), igt_fb_modifier_name(mod2));
+
 	igt_create_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
-		      I915_FORMAT_MOD_X_TILED, &fb[0]);
+		      mod1, &fb[0]);
 	igt_create_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
-		      I915_FORMAT_MOD_Y_TILED, &fb[1]);
+		      mod2, &fb[1]);
 
 	igt_plane_set_fb(data->plane, &fb[0]);
 	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
@@ -1113,11 +1139,6 @@ igt_main
 		test_init_ops(&data);
 		/* TODO: support more vendors */
 		igt_require(is_intel_device(data.drm_fd));
-		igt_require(igt_display_has_format_mod(&data.display, DRM_FORMAT_XRGB8888,
-						       I915_FORMAT_MOD_X_TILED));
-		igt_require(igt_display_has_format_mod(&data.display, DRM_FORMAT_XRGB8888,
-						       I915_FORMAT_MOD_Y_TILED));
-
 		run_test(&data, test_invalid);
 	}
 
-- 
2.34.1



More information about the igt-dev mailing list