[PATCH i-g-t v15 3/5] tests/kms_async_flips: Add test for all async format modifiers

Karthik B S karthik.b.s at intel.com
Thu Jun 26 08:42:24 UTC 2025


Hi Santhosh,

On 6/23/2025 4:39 PM, Santhosh Reddy Guddati wrote:
> Add a new subtest to iterate through all the supported async format
> modifier pair and perform async flips.
>
> V2: Add a check to avoid sync flip on all supported modifiers
>      subtest(Chaitanya).
>      Refactor and clean up code , split commit to include relevant
>      changes.
>
> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
> Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah at intel.com>
> ---
>   tests/kms_async_flips.c | 119 +++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 117 insertions(+), 2 deletions(-)
>
> diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
> index bf14a1a93..496d1c2c8 100644
> --- a/tests/kms_async_flips.c
> +++ b/tests/kms_async_flips.c
> @@ -36,6 +36,7 @@
>   #include "igt.h"
>   #include "igt_aux.h"
>   #include "igt_psr.h"
> +#include "igt_vec.h"
>   #include <sys/ioctl.h>
>   #include <sys/time.h>
>   #include <poll.h>
> @@ -96,6 +97,9 @@
>    * SUBTEST: async-flip-with-page-flip-events-linear-atomic
>    * Description: Verify the async flip functionality and the fps during async flips
>    *		with linear modifier in Atomic API
> + *
> + * SUBTEST: async-flip-with-all-modifiers-formats
> + * Description: Verify the async flip functionality with all supported modifiers and formats
Please call out that we're having a sanity/basic-modeset validation with 
this subtest currently. Rename the subtest accordingly.
>    */
>   
>   #define CURSOR_POS 128
> @@ -137,8 +141,15 @@ typedef struct {
>   	bool atomic_path;
>   	bool overlay_path;
>   	bool linear_modifier;
> +	unsigned int plane_format;
> +	bool async_mod_formats;
>   } data_t;
>   
> +struct format_mod {
> +	uint64_t modifier;
> +	uint32_t format;
> +};
> +
>   static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
>   			 unsigned int tv_usec, void *_data)
>   {
> @@ -211,7 +222,7 @@ static void make_fb(data_t *data, struct igt_fb *fb,
>   
>   	rec_width = width / (NUM_FBS * 2);
>   
> -	igt_create_color_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
> +	igt_create_color_fb(data->drm_fd, width, height, data->plane_format,
>   			    data->modifier, 0.0, 0.0, 0.5, fb);
>   
>   	cr = igt_get_cairo_ctx(data->drm_fd, fb);
> @@ -408,6 +419,15 @@ static void test_async_flip(data_t *data)
>   			}
>   		}
>   
> +		if (data->async_mod_formats) {
> +			if (async_flip_needs_extra_frame(data)) {
> +				ret = perform_flip(data, frame, flags);
> +				igt_assert_eq(ret, 0);
> +
> +				wait_flip_event(data);
> +			}
> +		}
> +
>   		ret = perform_flip(data, frame, flags);
>   
>   		/* AMD cannot perform async page flip if fb mem type changes,
> @@ -437,10 +457,18 @@ static void test_async_flip(data_t *data)
>   			igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE);
>   		}
>   
> +		/* Reduce test execution for all formats and modifiers.*/

Lets plan to eventually have full execution for all the formats may be 
with an extended flag. Please add a TODO to call that out.

With these minor updates,

Reviewed-by: Karthik B S <karthik.b.s at intel.com>

Regards,
Karthik.B.S
> +		if (data->async_mod_formats) {
> +			igt_assert_f(ret == 0, "Async flip failed with %s modifier and %s format",
> +				     igt_fb_modifier_name(data->modifier),
> +				     igt_format_str(data->plane_format));
> +			break;
> +		}
> +
>   		frame++;
>   	} while (diff.tv_sec < RUN_TIME);
>   
> -	if (!data->alternate_sync_async) {
> +	if (!data->alternate_sync_async && !data->async_mod_formats) {
>   		fps = frame * 1000 / RUN_TIME;
>   		igt_assert_f((fps / 1000) > (data->refresh_rate * MIN_FLIPS_PER_FRAME),
>   			     "FPS should be significantly higher than the refresh rate\n");
> @@ -808,6 +836,87 @@ static void run_test(data_t *data, void (*test)(data_t *))
>   	}
>   }
>   
> +static bool skip_async_format_mod(data_t *data,
> +			    uint32_t format, uint64_t modifier,
> +			    struct igt_vec *tested_formats)
> +{
> +	/* igt doesn't know how to sw generate UBWC: */
> +	if (is_msm_device(data->drm_fd) &&
> +	    modifier == DRM_FORMAT_MOD_QCOM_COMPRESSED)
> +		return true;
> +
> +	/* VEBOX just hangs with an actual 10bpc format */
> +	if (igt_fb_is_gen12_mc_ccs_modifier(modifier) &&
> +	    igt_reduce_format(format) == DRM_FORMAT_XRGB2101010)
> +		return true;
> +
> +	/* test each format "class" only once in non-extended tests */
> +	struct format_mod rf = {
> +		.format = igt_reduce_format(format),
> +		.modifier = modifier,
> +	};
> +
> +	if (igt_vec_index(tested_formats, &rf) >= 0)
> +		return true;
> +
> +	igt_vec_push(tested_formats, &rf);
> +
> +	return false;
> +}
> +
> +static void run_test_with_async_format_modifiers(data_t *data, void (*test)(data_t *))
> +{
> +	struct igt_vec tested_formats;
> +
> +	igt_vec_init(&tested_formats, sizeof(struct format_mod));
> +
> +	for_each_pipe_with_valid_output(&data->display, data->pipe, data->output) {
> +		test_init(data);
> +
> +		igt_assert_f(data->plane->async_format_mod_count > 0,
> +			     "No async format/modifier supported\n");
> +
> +		for (int i = 0; i < data->plane->async_format_mod_count; i++) {
> +			struct format_mod f = {
> +				.format = data->plane->async_formats[i],
> +				.modifier = data->plane->async_modifiers[i],
> +			};
> +
> +			if (skip_async_format_mod(data, f.format, f.modifier, &tested_formats)) {
> +				igt_debug("Skipping format " IGT_FORMAT_FMT " / modifier "
> +					   IGT_MODIFIER_FMT " on %s.%u\n",
> +					   IGT_FORMAT_ARGS(f.format),
> +					   IGT_MODIFIER_ARGS(f.modifier),
> +					   kmstest_pipe_name(data->pipe),
> +					   data->plane->index);
> +				continue;
> +			}
> +
> +			data->modifier = f.modifier;
> +			data->plane_format = f.format;
> +			data->async_mod_formats = true;
> +
> +			igt_dynamic_f("pipe-%s-%s-%s-%s", kmstest_pipe_name(data->pipe),
> +				      data->output->name,
> +				      igt_fb_modifier_name(data->modifier),
> +				      igt_format_str(data->plane_format)) {
> +				      /*
> +				       * FIXME: joiner+async flip is busted currently in KMD.
> +				       * Remove this check once the issues are fixed in KMD.
> +				       */
> +				      igt_skip_on_f(is_joiner_mode(data->drm_fd,
> +								   data->output),
> +						    "Skipping, async flip not supported "
> +						    "on joiner mode\n");
> +				      test_init_fbs(data);
> +				      test(data);
> +			}
> +		}
> +	}
> +
> +	igt_vec_fini(&tested_formats);
> +}
> +
>   static void run_test_with_modifiers(data_t *data, void (*test)(data_t *))
>   {
>   	if (data->atomic_path)
> @@ -868,6 +977,7 @@ igt_main
>   
>   		if (is_intel_device(data.drm_fd))
>   			data.bops = buf_ops_create(data.drm_fd);
> +		data.plane_format = DRM_FORMAT_XRGB8888;
>   	}
>   
>   	igt_describe("Verify the async flip functionality and the fps during async flips");
> @@ -1033,6 +1143,11 @@ igt_main
>   		run_test(&data, test_async_flip);
>   	}
>   
> +	igt_describe("Verify async flip with all supported modifier and format combinations");
> +	igt_subtest_with_dynamic("async-flip-with-all-modifiers-formats") {
> +		run_test_with_async_format_modifiers(&data, test_async_flip);
> +	}
> +
>   	igt_fixture {
>   		for (i = 0; i < NUM_FBS; i++) {
>   			igt_remove_fb(data.drm_fd, &data.bufs[i]);


More information about the igt-dev mailing list