[Intel-gfx] [PATCH i-g-t] tests/kms_flip: Fix assert about vblank wait duration

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Fri Nov 28 15:57:59 CET 2014


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

If we wait for one vblank, we may end up returning almost immediately,
so trying to assert anything but >0 about the minimum duration is
bogus.

Instead wait for two vblanks and then we can assert that we should have
be blocked for at least one frame. And move the upper bound to a little
over two frames to match.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79050
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/kms_flip.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index cce9594..041f46a 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -867,10 +867,16 @@ static unsigned int run_test_step(struct test_output *o)
 
 		/* modeset/DPMS is done, vblank wait should work normally now */
 		start = gettime_us();
-		igt_assert(__wait_for_vblank(TEST_VBLANK_BLOCK, o->pipe, 1, 0, &reply) == 0);
+		igt_assert(__wait_for_vblank(TEST_VBLANK_BLOCK, o->pipe, 2, 0, &reply) == 0);
 		end = gettime_us();
-		igt_assert(end - start > 1 * frame_time(o) / 2 &&
-			   end - start < 3 * frame_time(o) / 2);
+		/*
+		 * we waited for two vblanks, so verify that
+		 * we were blocked for ~1-2 frames.
+		 */
+		igt_assert_f(end - start > 0.9 * frame_time(o) &&
+			     end - start < 2.1 * frame_time(o),
+			     "wait for two vblanks took %lu usec (frame time %f usec)\n",
+			     end - start, frame_time(o));
 		join_vblank_wait_thread();
 	}
 
-- 
2.0.4




More information about the Intel-gfx mailing list