[Intel-gfx] [PATCH i-g-t 3/6] tests/kms_flip: Use USEC_PER_SEC

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Tue Jun 21 17:25:29 UTC 2016


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

Replace some opencoded numbers with USEC_PER_SEC, and
print the usec_diff with 6 decimal digits to make things
more consistent.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_flip.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 7b526b5e8593..743e4ad8f673 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -717,15 +717,15 @@ static void check_state_correlation(struct test_output *o,
 		return;
 
 	timersub(&es2->current_ts, &es1->current_ts, &tv_diff);
-	usec_diff = tv_diff.tv_sec * 1000 * 1000 + tv_diff.tv_usec;
+	usec_diff = tv_diff.tv_sec * USEC_PER_SEC + tv_diff.tv_usec;
 
 	seq_diff = es2->current_seq - es1->current_seq;
 	ftime = frame_time(o);
 	usec_diff -= seq_diff * ftime;
 
 	igt_assert_f(fabs(usec_diff) / ftime <= 0.005,
-		     "timestamp mismatch between %s and %s (diff %.4f sec)\n",
-		     es1->name, es2->name, usec_diff / 1000 / 1000);
+		     "timestamp mismatch between %s and %s (diff %.6f sec)\n",
+		     es1->name, es2->name, usec_diff / USEC_PER_SEC);
 }
 
 static void check_all_state(struct test_output *o,
-- 
2.7.4



More information about the Intel-gfx mailing list