From patchwork Fri May 13 11:45:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Feceoru, Gabriel" X-Patchwork-Id: 9090711 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E1FCCBF29F for ; Fri, 13 May 2016 11:44:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1DE7120251 for ; Fri, 13 May 2016 11:44:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 395DA2022D for ; Fri, 13 May 2016 11:44:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 93AE56E144; Fri, 13 May 2016 11:44:56 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id BE3176E144 for ; Fri, 13 May 2016 11:44:54 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 13 May 2016 04:44:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,614,1455004800"; d="scan'208";a="102598887" Received: from gfeceoru-ms-7924.rb.intel.com ([10.237.104.199]) by fmsmga004.fm.intel.com with ESMTP; 13 May 2016 04:44:53 -0700 From: Gabriel Feceoru To: intel-gfx@lists.freedesktop.org Date: Fri, 13 May 2016 14:45:09 +0300 Message-Id: <1463139909-12826-1-git-send-email-gabriel.feceoru@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462886858-425-1-git-send-email-gabriel.feceoru@intel.com> References: <1462886858-425-1-git-send-email-gabriel.feceoru@intel.com> Cc: Jani Nikula , Daniel Vetter Subject: [Intel-gfx] [PATCH i-g-t v3] 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: , MIME-Version: 1.0 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 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 Cc: Daniel Vetter Signed-off-by: Gabriel Feceoru --- tests/kms_flip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index eda2fcc..6ec97d0 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); } }