summaryrefslogtreecommitdiff
path: root/tests/kms_flip.c
diff options
context:
space:
mode:
authorFeceoru, Gabriel <gabriel.feceoru@intel.com>2016-05-13 14:45:09 +0300
committerMarius Vlad <marius.c.vlad@intel.com>2016-05-16 18:20:41 +0300
commit5cc3175ca5a0374c17bd201ba5a35ef4ff076003 (patch)
tree45e0463e74f9a0803c195bb7f386c5898fdcdfc0 /tests/kms_flip.c
parentc785a89ee61807d2e8d76847481225e649aa5aec (diff)
tests/kms_flip: Adjust tolerance when counting frames
basic-flip-vs-wf_vblank subtest sometimes fails asserting counted frames to be aproximately equal with the estimated number. This is a false negative, one of the reasons being the precision lost when truncating a fractional number. Fixed this by using floating point arithmetic. Cc: Jani Nikula <jani.nikula@intel.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95380 [mvlad] Signed-off-by: Gabriel Feceoru <gabriel.feceoru@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
Diffstat (limited to 'tests/kms_flip.c')
-rw-r--r--tests/kms_flip.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index eda2fcc9..6ec97d0a 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1182,13 +1182,13 @@ static void check_final_state(struct test_output *o, struct event_state *es,
/* Verify we drop no frames, but only if it's not a TV encoder, since
* those use some funny fake timings behind userspace's back. */
if (o->flags & TEST_CHECK_TS && !analog_tv_connector(o)) {
- int expected;
+ double expected;
int count = es->count;
count *= o->seq_step;
- 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 = (double)elapsed / frame_time(o);
+ igt_assert_f(fabs((double)count - expected)/expected <= 0.01,
+ "dropped frames, expected %f, counted %d, encoder type %d\n",
expected, count, o->kencoder[0]->encoder_type);
}
}