[PATCH i-g-t v3] tests/kms_async_flips: Fix for HRR panels
Karthik B S
karthik.b.s at intel.com
Tue Aug 26 05:37:24 UTC 2025
On 8/8/2025 5:14 PM, Santhosh Reddy Guddati wrote:
> Current logic in the test is too strict for high refresh panels,
> It expects the flips per frame to be 5x times the refresh rate which is
> not ideal for high refresh like 240 , 360 Hz.
>
> Introduce func to determine min flips per frame depending on refresh
> rate of the panel.
>
> v2: Remove hard coded values and calculate min flips based on refresh
> rate dynamically (Karthik)
> v3: Revert changes in test_crc()
>
> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
Reviewed-by: Karthik B S <karthik.b.s at intel.com>
> ---
> tests/kms_async_flips.c | 27 +++++++++++++++++++++++----
> 1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
> index 1ac5e6db0..bbfcc0c10 100644
> --- a/tests/kms_async_flips.c
> +++ b/tests/kms_async_flips.c
> @@ -117,7 +117,7 @@
> */
>
> #define RUN_TIME 2
> -#define MIN_FLIPS_PER_FRAME 5
> +#define MIN_FLIPS_PER_FRAME_60HZ 5
> #define NUM_FBS 4
>
> IGT_TEST_DESCRIPTION("Test asynchronous page flips.");
> @@ -158,6 +158,22 @@ struct format_mod {
> uint32_t format;
> };
>
> +static int min_flips_per_frame(unsigned int refresh_rate)
> +{
> + /*
> + * Calculate minimum flips per frame based on refresh rate scaling from 60Hz baseline
> + *
> + * High refresh rate displays fail async flip tests due to
> + * unrealistic timing expectations.
> + * This ensures async flip tests remain meaningful across all refresh rates
> + * while avoiding false failures due to overly strict timing requirements.
> + */
> + int min_flips = MIN_FLIPS_PER_FRAME_60HZ * 60 / refresh_rate;
> +
> + /* Ensure to have at least 1 flip per frame */
> + return max(min_flips, 1);
> +}
> +
> static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
> unsigned int tv_usec, void *_data)
> {
> @@ -415,6 +431,9 @@ static void test_async_flip(data_t *data)
> int mid_time = RUN_TIME / 2;
> float run_time;
> bool temp = data->suspend_resume || data->hang || data->dpms;
> + int min_flips;
> +
> + min_flips = min_flips_per_frame(data->refresh_rate);
>
> igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
>
> @@ -473,10 +492,10 @@ static void test_async_flip(data_t *data)
> timersub(&end, &start, &diff);
>
> if (data->alternate_sync_async) {
> - igt_assert_f(data->flip_interval < 1000.0 / (data->refresh_rate * MIN_FLIPS_PER_FRAME),
> + igt_assert_f(data->flip_interval < 1000.0 / (data->refresh_rate * min_flips),
> "Flip interval not significantly smaller than vblank interval\n"
> "Flip interval: %lfms, Refresh Rate = %dHz, Threshold = %d\n",
> - data->flip_interval, data->refresh_rate, MIN_FLIPS_PER_FRAME);
> + data->flip_interval, data->refresh_rate, min_flips);
> }
>
> if (data->suspend_resume && diff.tv_sec == mid_time && temp) {
> @@ -527,7 +546,7 @@ static void test_async_flip(data_t *data)
>
> 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),
> + igt_assert_f((fps / 1000) > (data->refresh_rate * min_flips),
> "FPS should be significantly higher than the refresh rate\n");
> }
> }
More information about the igt-dev
mailing list