[Mesa-dev] [PATCH] kms_flip: Improve the accuracy of out frame time calculation

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Mon Aug 11 06:31:06 PDT 2014


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Don't use the rounded vrefresh info to predict the frame duration.
Instead calculate if from the clock.
---
 tests/kms_flip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 227a176..f609ac0 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -431,7 +431,7 @@ static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
 
 static double frame_time(struct test_output *o)
 {
-	return 1000.0 * 1000.0 / o->kmode[0].vrefresh;
+	return 1000.0 * o->kmode[0].htotal * o->kmode[0].vtotal / o->kmode[0].clock;
 }
 
 static void fixup_premature_vblank_ts(struct test_output *o,
@@ -1017,7 +1017,7 @@ static void check_final_state(struct test_output *o, struct event_state *es,
 		int count = es->count;
 
 		count *= es->seq_step;
-		expected = elapsed * o->kmode[0].vrefresh / (1000 * 1000);
+		expected = elapsed / frame_time(o);
 		igt_assert_f(count >= expected * 99/100 && count <= expected * 101/100,
 			     "dropped frames, expected %d, counted %d, encoder type %d\n",
 			     expected, count, o->kencoder[0]->encoder_type);
-- 
1.8.1.5



More information about the mesa-dev mailing list