From patchwork Tue May 17 07:41:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9110061 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 7A1709F1C1 for ; Tue, 17 May 2016 07:41:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF31A201B9 for ; Tue, 17 May 2016 07:41:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 19E21200E8 for ; Tue, 17 May 2016 07:41:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D1CE6E624; Tue, 17 May 2016 07:41:39 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [87.106.93.118]) by gabe.freedesktop.org (Postfix) with ESMTP id 1733A6E624 for ; Tue, 17 May 2016 07:41:36 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from nuc-i3427.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 59671056-1500048 for multiple; Tue, 17 May 2016 08:41:41 +0100 Received: by nuc-i3427.alporthouse.com (sSMTP sendmail emulation); Tue, 17 May 2016 08:41:31 +0100 Date: Tue, 17 May 2016 08:41:31 +0100 From: Chris Wilson To: Daniel Vetter Message-ID: <20160517074131.GC30479@nuc-i3427.alporthouse.com> Mail-Followup-To: Chris Wilson , Daniel Vetter , Gabriel Feceoru , daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org References: <1462886858-425-1-git-send-email-gabriel.feceoru@intel.com> <87posu6mvf.fsf@intel.com> <5731ED09.7060002@intel.com> <20160517073059.GP27098@phenom.ffwll.local> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160517073059.GP27098@phenom.ffwll.local> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: intel-gfx@lists.freedesktop.org, daniel.vetter@ffwll.ch Subject: Re: [Intel-gfx] [PATCH i-g-t] 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 Tue, May 17, 2016 at 09:30:59AM +0200, Daniel Vetter wrote: > On Tue, May 10, 2016 at 05:15:37PM +0300, Gabriel Feceoru wrote: > > > > > > On 10.05.2016 16:52, Jani Nikula wrote: > > >On Tue, 10 May 2016, Gabriel Feceoru wrote: > > >>Comparing 2 numbers with 1% accuracy depends on which one is the > > >>reference. If count == 100 and expected == 99 this condition fails, > > >>although it should pass. > > > > > >Well, the expectation should be the reference. If you expect 50 at 50% > > >tolerance, 25..75 is okay. 100 is clearly out of tolerance, but your > > >method would accept it too. > > > > > >Would it help to round the lower limit down and upper limit up? I think > > >that would be more acceptable. > > > > Yes, you are right. I'll adjust it to 98/100 and 102/100. > > Maybe also extract the computation for lower/upper limit into local > variables, to make the code less dense and easier to understand. Just because I have this lying around (untested): -Chris diff --git a/tests/kms_flip.c b/tests/kms_flip.c index eda2fcc..22b9c9d 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -1182,14 +1182,14 @@ 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; - int count = es->count; + int count = es->count * o->seq_step; + unsigned int min = frame_time(o) * (count - 1); + unsigned int max = frame_time(o) * (count + 1); - count *= o->seq_step; - expected = elapsed / frame_time(o); - igt_assert_f(count >= expected * 99/100 && count <= expected * 101/100, + igt_assert_f(elapsed > min && elapsed < max, "dropped frames, expected %d, counted %d, encoder type %d\n", - expected, count, o->kencoder[0]->encoder_type); + elapsed / frame_time(o), count, + o->kencoder[0]->encoder_type); } }