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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux