[PATCH i-g-t] tests/kms_async_flips: Fix for HRR panels

Karthik B S karthik.b.s at intel.com
Fri Jun 13 05:54:26 UTC 2025


Hi Santhosh,

On 6/12/2025 11:48 AM, 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.
>
> Signed-off-by: Santhosh Reddy Guddati <santhosh.reddy.guddati at intel.com>
> ---
>   tests/kms_async_flips.c | 24 +++++++++++++++++++++---
>   1 file changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
> index 97128cfad..5669d450e 100644
> --- a/tests/kms_async_flips.c
> +++ b/tests/kms_async_flips.c
> @@ -139,6 +139,18 @@ typedef struct {
>   	bool linear_modifier;
>   } data_t;
>   
> +static int min_flips_per_frame(unsigned int refresh_rate)
> +{

I agree with this logic of having lower min flips per frame for higher 
RR, but can we have logic to calculate the min flips dynamically for 
refresh rate rather than hard-coding it for certain refresh rates?

Maybe something like below,

min_flips = MIN_FLIPS_PER_FRAME * 60 / rr;

We could even rename MIN_FLIPS_PER_FRAME to MIN_FLIPS_PER_FRAME_60Hz or 
something?

Thanks,
Karthik.B.S
> +	if (refresh_rate >= 480)
> +		return 1;
> +	else if (refresh_rate >= 240)
> +		return 2;
> +	else if (refresh_rate >= 144)
> +		return 3;
> +	else
> +		return MIN_FLIPS_PER_FRAME;
> +}
> +
>   static void flip_handler(int fd_, unsigned int sequence, unsigned int tv_sec,
>   			 unsigned int tv_usec, void *_data)
>   {
> @@ -377,6 +389,9 @@ static void test_async_flip(data_t *data)
>   	long long int fps;
>   	struct timeval start, end, diff;
>   	int suspend_time = RUN_TIME / 2;
> +	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);
>   
> @@ -421,10 +436,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 == suspend_time) {
> @@ -712,9 +727,12 @@ static void test_crc(data_t *data)
>   	unsigned int start;
>   	int ret, width, height;
>   	drmModeModeInfoPtr mode;
> +	int min_flips;
>   
>   	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
>   
> +	min_flips = min_flips_per_frame(data->refresh_rate);
> +
>   	/* make things faster by using a smallish mode */
>   	mode = &data->output->config.connector->modes[0];
>   	width = mode->hdisplay;
> @@ -763,7 +781,7 @@ static void test_crc(data_t *data)
>   	igt_pipe_crc_free(data->pipe_crc);
>   
>   	/* make sure we got at a reasonable number of async flips done */
> -	igt_assert_lt(data->frame_count * 2, data->flip_count);
> +	igt_assert_lt(data->frame_count * min_flips, data->flip_count);
>   }
>   
>   static void run_test(data_t *data, void (*test)(data_t *))


More information about the igt-dev mailing list