diff mbox

[i-g-t,v2] tests/kms_flip: Adjust tolerance when counting frames

Message ID 1462890827-18603-1-git-send-email-gabriel.feceoru@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Feceoru, Gabriel May 10, 2016, 2:33 p.m. UTC
If count == 100 and expected == 99 this condition fails (99*101/100 = 99.99).

(v2): Increased the tolerance range, as suggested by Jani.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Gabriel Feceoru <gabriel.feceoru@intel.com>
---
 tests/kms_flip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jani Nikula May 10, 2016, 3:39 p.m. UTC | #1
On Tue, 10 May 2016, Gabriel Feceoru <gabriel.feceoru@intel.com> wrote:
> If count == 100 and expected == 99 this condition fails (99*101/100 = 99.99).
>
> (v2): Increased the tolerance range, as suggested by Jani.
>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Signed-off-by: Gabriel Feceoru <gabriel.feceoru@intel.com>
> ---
>  tests/kms_flip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index eda2fcc..ceb0e0b 100644
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -1187,7 +1187,7 @@ static void check_final_state(struct test_output *o, struct event_state *es,
>  
>  		count *= o->seq_step;
>  		expected = elapsed / frame_time(o);
> -		igt_assert_f(count >= expected * 99/100 && count <= expected * 101/100,
> +		igt_assert_f(count >= expected * 98/100 && count <= expected * 102/100,

I was thinking of

#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))

igt_assert_f(count >= expected * 99 / 100 &&
             count <= DIV_ROUND_UP(expected * 101, 100));

but maybe someone who knows how accurate this should really be could
chime in.

BR,
Jani.


>  			     "dropped frames, expected %d, counted %d, encoder type %d\n",
>  			     expected, count, o->kencoder[0]->encoder_type);
>  	}
diff mbox

Patch

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index eda2fcc..ceb0e0b 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1187,7 +1187,7 @@  static void check_final_state(struct test_output *o, struct event_state *es,
 
 		count *= o->seq_step;
 		expected = elapsed / frame_time(o);
-		igt_assert_f(count >= expected * 99/100 && count <= expected * 101/100,
+		igt_assert_f(count >= expected * 98/100 && count <= expected * 102/100,
 			     "dropped frames, expected %d, counted %d, encoder type %d\n",
 			     expected, count, o->kencoder[0]->encoder_type);
 	}