[PATCH i-g-t v1 3/3] tests/kms_flip: Adjust frame time checks based on refresh rate

Naladala Ramanaidu ramanaidu.naladala at intel.com
Fri May 9 05:13:52 UTC 2025


Optimize check_final_state function for high refresh rates by
adjusting frame time checks.

Signed-off-by: Naladala Ramanaidu <ramanaidu.naladala at intel.com>
---
 tests/kms_flip.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 91e9da690..294624762 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -56,6 +56,8 @@
 #include "igt_stats.h"
 #include "xe/xe_query.h"
 
+#define USECS_PER_SEC (1000000ull)
+
 /**
  * SUBTEST: %s
  * Description: %arg[1] test to validate pageflips with available fences
@@ -1230,9 +1232,17 @@ static bool check_final_state(const struct test_output *o,
 	/* Verify we drop no frames, but only if it's not a TV encoder, since
 	 * those use some funny fake timings behind userspace's back. */
 	if (o->flags & TEST_CHECK_TS) {
+		uint32_t min, max;
 		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);
+		uint32_t refresh_rate = NSECS_PER_SEC / actual_frame_time(o);
+
+		if (refresh_rate <= 60) {
+			min = actual_frame_time(o) * (count - 1);
+			max = actual_frame_time(o) * (count + 1);
+		} else {
+			min = actual_frame_time(o) * (count - 2);
+			max = actual_frame_time(o) * (count + 2);
+		}
 
 		igt_debug("expected %d, counted %d, encoder type %d\n",
 			  (int)(elapsed / actual_frame_time(o)), count,
-- 
2.43.0



More information about the igt-dev mailing list