From patchwork Thu Sep 8 12:38:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 9321263 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 2493060869 for ; Thu, 8 Sep 2016 12:39:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13AB42982D for ; Thu, 8 Sep 2016 12:39:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 085D72982B; Thu, 8 Sep 2016 12:39: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 6BBEC29829 for ; Thu, 8 Sep 2016 12:39:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE38A6E1F3; Thu, 8 Sep 2016 12:39:13 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D6396E1D3 for ; Thu, 8 Sep 2016 12:39:12 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id w12so7695103wmf.1 for ; Thu, 08 Sep 2016 05:39:12 -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:in-reply-to:references; bh=t6Hq9Meqjrde/yriNpaSKby/2O1nzpsvXyIMLZUGQhU=; b=Lzi8jqudwYtRW9nzJCpfu58BPbWEeFqpCbkP3FxV7pGsZV9IQb5S9gqheidzl6BWqX yMbTxA/D/ayhMRs/B9GhmRTVTH6LZw/Q9SNCWboX2jOhx0a/nLPY6kde48Z4SrnACc/V F7c3cpEBIch1vNhsLKMhneyrNNGZTQ+Cq5gfI8N7JJJE0BUOu/TJ37/9v/m14EVfExT4 pgL+79EcXxCChR1CbZAQzLfHs3cKVGorqgDHX0tEaF0rlv/UM6DA4CboS0jgIRRH0CLS 5rmoS0OBrKZlpWBarp8L/fyZTU/bKBeHNaLmeCOL5v2bSm8dWq0SzAniugm0pSKxQA2U s5mA== 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 :in-reply-to:references; bh=t6Hq9Meqjrde/yriNpaSKby/2O1nzpsvXyIMLZUGQhU=; b=HJ9UOjrM3CTnAgXk/M0JpgM6Efh4vAXPOgvw708NV3lJfEQZQbYjkttwc4XkBZCO0k vjY6fu6bH+tYvJiu2sr27XNZtV+eZ6da75foXK6dbiuRMzmUJANNI6BuQnULHuuJKSr/ 2isAlvQZzOiLjGveuh557ZuNaG9CusfkDthliheK2EcgL7Vh/fBaAz9qBWJ8v6nIFIx9 sGI2BhQmyALzfOXLACOMJX/OX0A9H+Kwpb1DaKxy5SHjitAPPEVS+Zj/e2I4w8Si1an5 1pJubgb2B3T788AbUtSTjEV5a0N/43g2C4lfAb2T/jVkoPyLG8Ccn9LNaKC+2TMZDSuq kHIQ== X-Gm-Message-State: AE9vXwMlQgEbvTNV5HqngwEhjgZU6segL32TpjgovZ6sVsVZTBXXMj4y55dj4X/3qOHt3Q== X-Received: by 10.28.139.75 with SMTP id n72mr43738wmd.104.1473338350747; Thu, 08 Sep 2016 05:39:10 -0700 (PDT) Received: from cizrna.lan ([109.72.12.101]) by smtp.gmail.com with ESMTPSA id 17sm9509806wmf.6.2016.09.08.05.39.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Sep 2016 05:39:09 -0700 (PDT) From: Tomeu Vizoso To: Intel GFX discussion Date: Thu, 8 Sep 2016 14:38:44 +0200 Message-Id: <1473338324-6986-2-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473338324-6986-1-git-send-email-tomeu.vizoso@collabora.com> References: <1473338324-6986-1-git-send-email-tomeu.vizoso@collabora.com> Cc: Tomeu Vizoso Subject: [Intel-gfx] [PATCH i-g-t 2/2] lib/debugfs: Report failures when starting CRC capture 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 For drivers other than i915, the "auto" source for a given CRTC may be only able to generate CRCs in specific modeset configurations. So allow the tests to find out if CRC generation is possible by returning an error when CRC capture would start so tests can be skipped. Signed-off-by: Tomeu Vizoso --- lib/igt_debugfs.c | 28 ++++++++++++++++++++-------- lib/igt_debugfs.h | 4 ++-- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 1bbbabc9f1c9..4b64ad8d4834 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -325,7 +325,7 @@ static const char *pipe_crc_source_name(enum intel_pipe_crc_source source) return pipe_crc_sources[source]; } -static bool igt_pipe_crc_do_start(igt_pipe_crc_t *pipe_crc) +static int igt_pipe_crc_do_start(igt_pipe_crc_t *pipe_crc) { char buf[64]; int mode = O_RDONLY; @@ -342,7 +342,7 @@ static bool igt_pipe_crc_do_start(igt_pipe_crc_t *pipe_crc) errno = 0; igt_assert_eq(write(pipe_crc->ctl_fd, buf, strlen(buf)), strlen(buf)); if (errno != 0) - return false; + return errno; if (!pipe_crc->is_legacy) { sprintf(buf, "crtc-%d/crc/data", pipe_crc->pipe); @@ -351,11 +351,11 @@ static bool igt_pipe_crc_do_start(igt_pipe_crc_t *pipe_crc) mode |= O_NONBLOCK; pipe_crc->crc_fd = igt_debugfs_open(buf, mode); if (pipe_crc->crc_fd == -1 && errno == EINVAL) - return false; + return errno; igt_assert_eq(errno, 0); } - return true; + return 0; } static void igt_pipe_crc_pipe_off(int fd, enum pipe pipe) @@ -633,11 +633,14 @@ static void read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out) * * Starts the CRC capture process on @pipe_crc. */ -void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc) +int igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc) { igt_crc_t crc; + int ret; - igt_assert(igt_pipe_crc_do_start(pipe_crc)); + ret = igt_pipe_crc_do_start(pipe_crc); + if (ret) + return ret; if (pipe_crc->is_legacy) { /* @@ -651,6 +654,8 @@ void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc) read_one_crc(pipe_crc, &crc); read_one_crc(pipe_crc, &crc); } + + return 0; } /** @@ -756,15 +761,22 @@ static void crc_sanity_checks(igt_crc_t *crc) * For continuous CRC collection look at igt_pipe_crc_start(), * igt_pipe_crc_get_crcs() and igt_pipe_crc_stop(). */ -void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc) +int igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc) { + int ret; + igt_debug_wait_for_keypress("crc"); - igt_pipe_crc_start(pipe_crc); + ret = igt_pipe_crc_start(pipe_crc); + if (ret) + return ret; + read_one_crc(pipe_crc, out_crc); igt_pipe_crc_stop(pipe_crc); crc_sanity_checks(out_crc); + + return 0; } /* diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index 84d5c0a0a84b..e51a89bbac30 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -124,12 +124,12 @@ igt_pipe_crc_new_legacy(enum pipe pipe, enum intel_pipe_crc_source source); igt_pipe_crc_t * igt_pipe_crc_new_nonblock_legacy(enum pipe pipe, enum intel_pipe_crc_source source); void igt_pipe_crc_free(igt_pipe_crc_t *pipe_crc); -void igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc); +int igt_pipe_crc_start(igt_pipe_crc_t *pipe_crc); void igt_pipe_crc_stop(igt_pipe_crc_t *pipe_crc); __attribute__((warn_unused_result)) int igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs, igt_crc_t **out_crcs); -void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc); +int igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc); /* * Drop caches