From patchwork Wed May 11 12:35:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Feceoru, Gabriel" X-Patchwork-Id: 9069051 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ED5329F1C1 for ; Wed, 11 May 2016 12:34:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D42D20154 for ; Wed, 11 May 2016 12:34:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C6C8E201C0 for ; Wed, 11 May 2016 12:34:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C34EE6E6FC; Wed, 11 May 2016 12:34:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 178456E6FC for ; Wed, 11 May 2016 12:34:32 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 11 May 2016 05:34:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,608,1455004800"; d="scan'208";a="950915429" Received: from gfeceoru-ms-7924.rb.intel.com (HELO [10.237.104.199]) ([10.237.104.199]) by orsmga001.jf.intel.com with ESMTP; 11 May 2016 05:34:30 -0700 To: Jani Nikula , intel-gfx@lists.freedesktop.org References: <1462886858-425-1-git-send-email-gabriel.feceoru@intel.com> <1462890827-18603-1-git-send-email-gabriel.feceoru@intel.com> <87eg997wio.fsf@intel.com> From: Gabriel Feceoru Message-ID: <573326F7.7030908@intel.com> Date: Wed, 11 May 2016 15:35:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <87eg997wio.fsf@intel.com> Cc: Daniel Vetter Subject: Re: [Intel-gfx] [PATCH i-g-t v2] tests/kms_flip: Adjust tolerance when counting frames X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 10.05.2016 18:39, Jani Nikula wrote: > On Tue, 10 May 2016, Gabriel Feceoru 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 >> Cc: Daniel Vetter >> Signed-off-by: Gabriel Feceoru >> --- >> 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: + "dropped frames, expected %f, counted %d, 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); >> } > 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,