From patchwork Thu Feb 9 09:43:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 9564291 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 4726A60216 for ; Thu, 9 Feb 2017 09:43:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21D0528502 for ; Thu, 9 Feb 2017 09:43:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16C1428512; Thu, 9 Feb 2017 09:43:45 +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, TVD_PH_BODY_ACCOUNTS_PRE, 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 5141E28502 for ; Thu, 9 Feb 2017 09:43:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5EB26EA5D; Thu, 9 Feb 2017 09:43:42 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2B05D6EA5A for ; Thu, 9 Feb 2017 09:43:42 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id u63so1967299wmu.2 for ; Thu, 09 Feb 2017 01:43:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=7nobwLjPGQoPZ957cgphAIWPnzWu/94kFlwo+8YdPpE=; b=PjS9zQbA4Nc0wu04w1J97EYwIZJxD8tEgSyQtWN11hYPl8W6GrFIP4H/D6SbUoAiLZ cAaCa6zawxST5cILcPAU9BIksCmPfRg3vkBO2DNn6ZABjw3hXEHNP6iURxOE+IHNVATH J9dBaTfeosQqrxff7I2Fp1Pq6D2UwJHAmj0z48+/Hr1pcTLti+wqbpEWHBH6yQZJzEu/ DQ+bltajf8Tht3OzSzRBm0OlCZcLH39Rl5fkfqZRFTuGWeYEAyhrbnxGedtx09g3UFHs 3X76s+uUMO0kukMq0VKWWBBJ5H6KzRFTkx9eEPH6Wh2kCtHU8QI+fPvq85ylABzfi7pG tCVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=7nobwLjPGQoPZ957cgphAIWPnzWu/94kFlwo+8YdPpE=; b=TYcXAQ7Lk6AWMtxWiY65u/NC7cDAygmFMsA6lsk5VT55UzQA9Po4zHNlkdYRlVgKNX s4parO7KXoGHJJaYVlZv0Dft/3HF1KYrFBNyXn5w+evEUl7J2RB0lBzvqIrks42/sckS 3r6eMQSJUDNg1Hk1KJ2+51aTVxKhL+IODt9O0Fb1+O5jTwsm9DffgGQUEH48HENCJLlc Intit31k2sDuO2uq78aQUOW4HQEPKF7/iUzIq6pgVmjb29yV+IeBsEpMPEzKYsNYS6+l 3KBpe/lG/pabDye3qknz6aoo39ptSELYCYf0QrfXXjBmcP/SJmB5ljw8Dkm/P4kY+WqH m5ug== X-Gm-Message-State: AMke39mVthaAw8nCQlft9bjZ2JayJqYHIM88LXN5H93ewmpA4NlucmFywyOQGyojlUWakg== X-Received: by 10.28.32.198 with SMTP id g189mr1940002wmg.37.1486633420583; Thu, 09 Feb 2017 01:43:40 -0800 (PST) Received: from cizrna.lan ([109.72.12.32]) by smtp.gmail.com with ESMTPSA id k4sm7862928wmf.22.2017.02.09.01.43.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Feb 2017 01:43:39 -0800 (PST) From: Tomeu Vizoso To: Intel GFX discussion Date: Thu, 9 Feb 2017 10:43:20 +0100 Message-Id: <20170209094320.28219-1-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.9.3 Cc: Tomeu Vizoso Subject: [Intel-gfx] [PATCH i-g-t] kms_flip: Calculate max acceptable delta for TEST_TS_CONT 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 Right now it's hardcoded to a maximum difference of 150 page flips to account the fixed amount of time that the suspend cycle should take, but in some cases suspending and resuming will take much more time due to unrelated issues. In my case, I have a machine in which the RTC will cause an interrupt storm (~8k interrupts per second) from the moment an alarm is set until the alarm actually fires. This causes so much CPU contention that the suspend cycle takes much longer and the 150 value is not enough. This patch takes into account the time that passed between the last two page flips and calculates an acceptable difference taking into account the vertical refresh rate of the current mode. Signed-off-by: Tomeu Vizoso References: https://bugs.freedesktop.org/show_bug.cgi?id=98289 --- tests/kms_flip.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 41406dfe9199..522777c24da2 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -500,17 +500,25 @@ static void check_state(const struct test_output *o, const struct event_state *e /* Check that the vblank frame didn't wrap unexpectedly. */ if (o->flags & TEST_TS_CONT) { + double elapsed; + unsigned max_delta; + /* Ignore seq_step here since vblank waits time out immediately * when we kill the crtc. */ igt_assert_f(es->current_seq - es->last_seq >= 0, "unexpected %s seq %u, should be >= %u\n", es->name, es->current_seq, es->last_seq); - igt_assert_f(es->current_seq - es->last_seq <= 150, + + timersub(&es->current_ts, &es->last_ts, &diff); + elapsed = 1e6*diff.tv_sec + diff.tv_usec; + max_delta = elapsed * o->kmode[0].vrefresh / 1e6; + + igt_assert_f(es->current_seq - es->last_seq <= max_delta, "unexpected %s seq %u, should be < %u\n", - es->name, es->current_seq, es->last_seq + 150); + es->name, es->current_seq, es->last_seq + max_delta); - igt_debug("testing ts continuity: Current frame %u, old frame %u\n", - es->current_seq, es->last_seq); + igt_debug("testing ts continuity: Current frame %u, old frame %u, max delta %u\n", + es->current_seq, es->last_seq, max_delta); } if (o->flags & TEST_CHECK_TS) {