From: Jani Nikula <jani.nikula@intel.com>
To: Gabriel Feceoru <gabriel.feceoru@intel.com>,
intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH i-g-t v2] tests/kms_flip: Adjust tolerance when counting frames
Date: Fri, 13 May 2016 08:45:55 +0300 [thread overview]
Message-ID: <87twi24ijw.fsf@intel.com> (raw)
In-Reply-To: <573326F7.7030908@intel.com>
On Wed, 11 May 2016, Gabriel Feceoru <gabriel.feceoru@intel.com> wrote:
> On 10.05.2016 18:39, Jani Nikula wrote:
>> 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.
>
> I've just realized that frame_time(0) is a float, so converting to int
> in that division will lose precision.
>
> Proposing this now:
>
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index eda2fcc..c2d3929 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,
Heh, I've been working on the kernel so long that I was trying to avoid
floats in my suggestion above.
This seems fine to me, except the condition should be <= not < I guess.
Please send a proper patch.
BR,
Jani.
> encoder type %d\n",
> expected, count,
> o->kencoder[0]->encoder_type);
> }
> }
>
> Regards,
> Gabriel.
>
>>
>>
>>> "dropped frames, expected %d, counted %d, encoder type %d\n",
>>> expected, count, o->kencoder[0]->encoder_type);
>>> }
>>
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-13 5:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 13:27 [PATCH i-g-t] tests/kms_flip: Adjust tolerance when counting frames Gabriel Feceoru
2016-05-10 13:52 ` Jani Nikula
2016-05-10 14:15 ` Gabriel Feceoru
2016-05-17 7:30 ` Daniel Vetter
2016-05-17 7:41 ` Chris Wilson
2016-05-10 14:33 ` [PATCH i-g-t v2] " Gabriel Feceoru
2016-05-10 15:39 ` Jani Nikula
2016-05-11 12:35 ` Gabriel Feceoru
2016-05-13 5:45 ` Jani Nikula [this message]
2016-05-13 11:45 ` [PATCH i-g-t v3] " Gabriel Feceoru
2016-05-13 12:00 ` Chris Wilson
2016-05-13 12:04 ` Chris Wilson
2016-05-13 12:54 ` Gabriel Feceoru
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87twi24ijw.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=daniel.vetter@intel.com \
--cc=gabriel.feceoru@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox