From patchwork Thu Oct 20 14:35:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9386969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9146F60762 for ; Thu, 20 Oct 2016 14:35:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 837DB29A58 for ; Thu, 20 Oct 2016 14:35:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7661229C78; Thu, 20 Oct 2016 14:35:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F404729A58 for ; Thu, 20 Oct 2016 14:35:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 827196E0CE; Thu, 20 Oct 2016 14:35:13 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35D666EB80 for ; Thu, 20 Oct 2016 14:35:11 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id x23so314257lfi.1 for ; Thu, 20 Oct 2016 07:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=6OsNXgM07u9mGjU0w7ccbcv1VS1vHyRRxKbMVhowk3A=; b=IATLYfAXGGflnZwy7M6Fbxms30a2KfUKzFY6lK/HJL18synnSKxhW4wR0JlqyGMTas ARuqTRedGBAFqytQK3NzlV4fsjOFrDk5gWKpYsWuW0Xy+PYa7P6uZxOI5pxvCYq6zewl yEmqd/Blao4G3ZFJSJzH9wi/acsy4ffD1D3ZOoM3JPjgyY/aSmIhziBcOquhBYT0hinZ 6VJPAQV22oFWHYR8oHXfaBcirlQMFklXWPk426UeKoRO/7wu1TTE83ZVu2fv03SLkZJ+ c3CEowGAhJ+IxNsk+cX23OoBdRdkN8C6QIKdPc5vCxSHRCCzACJMunQxnX8krrbikDPb XMmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=6OsNXgM07u9mGjU0w7ccbcv1VS1vHyRRxKbMVhowk3A=; b=Caq+q+sIGY21f3WMJCUWgTfOjuseRKwQO0HnMe6sHRmtvsYaADolWKRKYUj0h3FKM2 c/kGHebSBeAm3Y2LnKahCD106USXgXQ7D1pV5kbFF2HvW4enQsgYzZ4grn4dnD2EITqY mABEEVXYqsrlo+J5Yo5LK3JEzhbn9+0cdfEUa7cnly8uM13Co6l6hkY1Uvujwa1e127P 8aBgCyrgQ5X9B0LROPAa4lZmjBQWLgbCZJs+ddguj4nA2umSNcwAL5qzP2U1Nxg/7ZrV YUF6jLM1mTqueJkXsCJNGtTBgRu5styZuk3hzYjkhjIkmVV+G6be13NIOEB0pIp1v4jB 45lA== X-Gm-Message-State: AA6/9RlvCaRkYkc0ZKv52EzSAqgQOoY4+9ggHsRbQGLdQhnJdQOChPkYSGf6Ayau4Ap/TQ== X-Received: by 10.28.64.133 with SMTP id n127mr6327654wma.31.1476974109292; Thu, 20 Oct 2016 07:35:09 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id us3sm79286986wjb.32.2016.10.20.07.35.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2016 07:35:08 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 20 Oct 2016 15:35:04 +0100 Message-Id: <20161020143504.4305-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.9.3 Subject: [Intel-gfx] [PATCH igt] igt/kms_flip: Print more information to debug for flip timing checks 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-Virus-Scanned: ClamAV using ClamSMTP We have a cantiga that doesn't pass igt@kms_flip@basic-flip-vs-wf_vblank, and so knowing why is off the upmost priority! Before the assertions print the values we are about to test in greater detail. References: https://bugs.freedesktop.org/show_bug.cgi?id=98352 Signed-off-by: Chris Wilson --- tests/kms_flip.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 7646aaf..b30e07c 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -686,24 +686,23 @@ static void check_state(const struct test_output *o, const struct event_state *e } if ((o->flags & TEST_CHECK_TS) && (!analog_tv_connector(o))) { - double usec_interflip, usec_diff; + double elapsed, expected; timersub(&es->current_ts, &es->last_ts, &diff); - usec_diff = diff.tv_sec * USEC_PER_SEC + diff.tv_usec; + elapsed = 1e6*diff.tv_sec + diff.tv_usec; + expected = (es->current_seq - es->last_seq) * frame_time(o); - usec_interflip = (es->current_seq - es->last_seq) * frame_time(o); - igt_assert_f(fabs((usec_diff - usec_interflip) / - usec_interflip) <= 0.005, - "inconsistent %s ts/seq: last %ld.%06ld/%u, current %ld.%06ld/%u\n", - es->name, es->last_ts.tv_sec, es->last_ts.tv_usec, es->last_seq, - es->current_ts.tv_sec, es->current_ts.tv_usec, es->current_seq); + igt_debug("%s ts/seq: last %ld.%06ld/%u, current %ld.%06ld/%u: elapsed=%.1fus expected=%.1fus +- %.1fus, error %.1f%%\n", + es->name, es->last_ts.tv_sec, es->last_ts.tv_usec, es->last_seq, + es->current_ts.tv_sec, es->current_ts.tv_usec, es->current_seq, + elapsed, expected, expected * 0.005, + fabs((elapsed - expected) / expected) * 100); - usec_interflip = o->seq_step * frame_time(o); - igt_assert_f(fabs((usec_diff - usec_interflip) / - usec_interflip) <= 0.005, - "inter-%s ts jitter: %ld.%06ld, expected %.6f\n", - es->name, diff.tv_sec, diff.tv_usec, - usec_interflip / USEC_PER_SEC); + igt_assert_f(fabs((elapsed - expected) / expected) <= 0.005, + "inconsistent %s ts/seq: last %ld.%06ld/%u, current %ld.%06ld/%u: elapsed=%.1fus expected=%.1fus\n", + es->name, es->last_ts.tv_sec, es->last_ts.tv_usec, es->last_seq, + es->current_ts.tv_sec, es->current_ts.tv_usec, es->current_seq, + elapsed, expected); igt_assert_f(es->current_seq == es->last_seq + o->seq_step, "unexpected %s seq %u, expected %u\n", @@ -1192,14 +1191,17 @@ static void check_final_state(const struct test_output *o, /* 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)) { - double expected; - int count = es->count; - - count *= o->seq_step; - 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); + int count = es->count * o->seq_step; + unsigned int min = frame_time(o) * (count - 1); + unsigned int max = frame_time(o) * (count + 1); + + igt_debug("expected %d, counted %d, encoder type %d\n", + (int)(elapsed / frame_time(o)), count, + o->kencoder[0]->encoder_type); + igt_assert_f(elapsed >= min && elapsed <= max, + "dropped frames, expected %d, counted %d, encoder type %d\n", + (int)(elapsed / frame_time(o)), count, + o->kencoder[0]->encoder_type); } }