[PATCH i-g-t v5 2/2] tests/kms_flip: Track and report unexpected events with pass rate metric

Karthik B S karthik.b.s at intel.com
Mon Jun 23 09:41:35 UTC 2025


On 6/20/2025 1:35 AM, Naladala Ramanaidu wrote:
> At higher refresh rates, there is a possibility of flips being
> submitted during the evasion window, which can result in one extra
> frame and cause the test to fail. To address this, the test has
> been modified to calculate a pass rate based on the number of
> expected versus erroneous frames. A threshold of 85% is enforced
> to determine test success.
>
> v1: Patch #2 and #4 merge into single patch. (Karthik)
> v2: Address the regression failures.
>
> Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
Reviewed-by: Karthik B S <karthik.b.s at intel.com>
> ---
>   tests/kms_flip.c | 31 ++++++++++++++++---------------
>   1 file changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index ca31ef7dd..94a414ba7 100755
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -309,6 +309,7 @@ struct event_state {
>   	unsigned int current_seq;		/* kernel reported seq. num */
>   
>   	int count;				/* # of events of this type */
> +	int err_frames;				/* # of unexpected events */
>   
>   	/* Step between the current and next 'target' sequence number. */
>   	int seq_step;
> @@ -677,7 +678,7 @@ static void vblank_handler(int fd, unsigned int frame, unsigned int sec,
>   	fixup_premature_vblank_ts(o, &o->vblank_state);
>   }
>   
> -static bool check_state(const struct test_output *o, const struct event_state *es)
> +static bool check_state(const struct test_output *o, struct event_state *es)
>   {
>   	struct timeval diff;
>   
> @@ -706,7 +707,8 @@ static bool check_state(const struct test_output *o, const struct event_state *e
>   	    es->current_seq - (es->last_seq + o->seq_step) > 1UL << 23) {
>   		igt_debug("unexpected %s seq %u, should be >= %u\n",
>   			  es->name, es->current_seq, es->last_seq + o->seq_step);
> -		return false;
> +		es->err_frames++;
> +		return true;
>   	}
>   
>   	if (o->flags & TEST_CHECK_TS) {
> @@ -727,16 +729,16 @@ static bool check_state(const struct test_output *o, const struct event_state *e
>   				  es->name, timeval_float(&es->last_ts), es->last_seq,
>   				  timeval_float(&es->current_ts), es->current_seq,
>   				  elapsed, expected);
> -
> -			return false;
> +			es->err_frames++;
> +			return true;
>   		}
>   
>   		if (es->current_seq != es->last_seq + o->seq_step) {
>   			igt_debug("unexpected %s seq %u, expected %u\n",
>   				  es->name, es->current_seq,
>   				  es->last_seq + o->seq_step);
> -
> -			return false;
> +			es->err_frames++;
> +			return true;
>   		}
>   	}
>   
> @@ -1233,17 +1235,16 @@ static bool check_final_state(const struct test_output *o,
>   	 * those use some funny fake timings behind userspace's back. */
>   	if (o->flags & TEST_CHECK_TS) {
>   		int count = es->count * o->seq_step;
> -		unsigned int min = actual_frame_time(o) * (count - 1);
> -		unsigned int max = actual_frame_time(o) * (count + 1);
> +		int error_count = es->err_frames * o->seq_step;
> +		int expected = elapsed / actual_frame_time(o);
> +		float pass_rate = ((float)(count - error_count) / count) * 100;
>   
> -		igt_debug("expected %d, counted %d, encoder type %d\n",
> -			  (int)(elapsed / actual_frame_time(o)), count,
> -			  o->kencoder[0]->encoder_type);
> -		if (elapsed < min || elapsed > max) {
> -			igt_debug("dropped frames, expected %d, counted %d, encoder type %d\n",
> -				  (int)(elapsed / actual_frame_time(o)), count,
> -				  o->kencoder[0]->encoder_type);
> +		igt_info("Event %s: expected %d, counted %d, passrate = %.2f%%, encoder type %d\n",
> +			 es->name, expected, count, pass_rate, o->kencoder[0]->encoder_type);
>   
> +		if (pass_rate < 85) {
> +			igt_debug("dropped frames, expected %d, counted %d, passrate = %.2f%%, encoder type %d\n",
> +				  expected, count, pass_rate, o->kencoder[0]->encoder_type);
>   			return false;
>   		}
>   	}


More information about the igt-dev mailing list