[i-g-t V2] tests/kms_async_flips: Re-calculate min flips per frame

Bhanuprakash Modem bhanuprakash.modem at intel.com
Thu Mar 14 06:34:23 UTC 2024


As XE driver taking longer time for pinning, re-calculate to
reduce the expected min flips per frame (by assuming the min
pinning time as 1.2 ms). Otherwise test will fail, since we
can't achieve those many flips per frame.

V2:
  - Guard the logic with is_xe_device()

Cc: Vandita Kulkarni <vandita.kulkarni at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_async_flips.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index 2895168f7..a92f23c29 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -238,6 +238,21 @@ static void test_async_flip(data_t *data)
 	int ret, frame;
 	long long int fps;
 	struct timeval start, end, diff;
+	int min_flips_per_frame = MIN_FLIPS_PER_FRAME;
+
+	/*
+	 * FIXME: As pinning is taking moretime in XE, recalculate min frames
+	 * per frame (by considering the pinning time as 1.2 ms)
+	 */
+	if (is_xe_device(data->drm_fd)) {
+		min_flips_per_frame = 1000 / (data->refresh_rate * 1.2);
+		igt_require(min_flips_per_frame);
+
+		if (min_flips_per_frame > MIN_FLIPS_PER_FRAME)
+			min_flips_per_frame = MIN_FLIPS_PER_FRAME;
+	}
+
+	igt_info("Expected min flips per frame: %d\n", min_flips_per_frame);
 
 	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
@@ -296,10 +311,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_per_frame),
 				     "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_per_frame);
 		}
 
 		frame++;
@@ -307,7 +322,7 @@ static void test_async_flip(data_t *data)
 
 	if (!data->alternate_sync_async) {
 		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_per_frame),
 			     "FPS should be significantly higher than the refresh rate\n");
 	}
 }
-- 
2.43.2



More information about the igt-dev mailing list