tests/kms_flip: Fix assert about vblank wait duration

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@linux.intel.com>
This commit is contained in:
Ville Syrjälä 2014-11-28 11:13:45 +02:00
parent ddf0f09776
commit e06a7448d8

View File

@ -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();
}