From patchwork Thu Dec 22 20:42:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zanoni, Paulo R" X-Patchwork-Id: 9485635 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 6C82560405 for ; Thu, 22 Dec 2016 20:43:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F04527D85 for ; Thu, 22 Dec 2016 20:43:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53B1727F99; Thu, 22 Dec 2016 20:43:19 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 CAE8F27D85 for ; Thu, 22 Dec 2016 20:43:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 27A406F39D; Thu, 22 Dec 2016 20:43:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id D5CEF6F396 for ; Thu, 22 Dec 2016 20:42:19 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP; 22 Dec 2016 12:42:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,390,1477983600"; d="scan'208";a="42582944" Received: from przanoni-mobl.amr.corp.intel.com ([10.254.184.18]) by orsmga004.jf.intel.com with ESMTP; 22 Dec 2016 12:42:17 -0800 From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Thu, 22 Dec 2016 18:42:06 -0200 Message-Id: <1482439328-32197-4-git-send-email-paulo.r.zanoni@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482439328-32197-1-git-send-email-paulo.r.zanoni@intel.com> References: <1482439328-32197-1-git-send-email-paulo.r.zanoni@intel.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH igt 4/6] kms_frontbuffer_tracking: refactor sink CRC reliability handling 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 What I'm currently seeing is that sometimes the first check during setup_sink_crc() returns valid sink CRC, but then the subsequent checks return ETIMEDOUT. In these cases, we keep getting flooded by messages saying that our sink CRC is unreliable and that the results differ. This is annoying for the FBC tests where sink CRC is not mandatory. Since this case shows it's useless to try to check for sink CRC reliability before the actual tests, refactor the code in a way that if at any point we detect that sink CRC is unreliable we'll mark it as such and stop flooding the logs. For the tests where it's mandatory we'll still keep the same SKIP behavior. This refactor also allows us to just call get_sink_crc() in the setup_sink_crc() function instead of having to reimplement the same logic. Signed-off-by: Paulo Zanoni --- tests/kms_frontbuffer_tracking.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index 4a46942..8aa6362 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -203,9 +203,11 @@ struct both_crcs *wanted_crc; struct { int fd; bool supported; + bool reliable; } sink_crc = { .fd = -1, - .supported = false, + .supported = true, + .reliable = true, }; /* The goal of this structure is to easily allow us to deal with cases where we @@ -943,11 +945,17 @@ static void get_sink_crc(sink_crc_t *crc, bool mandatory) rc = read(sink_crc.fd, crc->data, SINK_CRC_SIZE); errno_ = errno; - if (rc == -1 && errno_ == ETIMEDOUT) { + if (rc == -1 && errno_ == ENOTTY) { + igt_info("Sink CRC not supported: panel doesn't support it\n"); + sink_crc.supported = false; + } else if (rc == -1 && errno_ == ETIMEDOUT) { + if (sink_crc.reliable) { + igt_info("Sink CRC is unreliable on this machine.\n"); + sink_crc.reliable = false; + } + if (mandatory) - igt_skip("Sink CRC is unreliable on this machine. Try running this test again individually\n"); - else - igt_info("Sink CRC is unreliable on this machine. Try running this test again individually\n"); + igt_skip("Sink CRC is unreliable on this machine.\n"); } else { igt_assert(rc == SINK_CRC_SIZE); } @@ -1396,9 +1404,7 @@ static void teardown_modeset(void) static void setup_sink_crc(void) { - ssize_t rc; sink_crc_t crc; - int errno_; drmModeConnectorPtr c; c = get_connector(prim_mode_params.connector_id); @@ -1418,17 +1424,8 @@ static void setup_sink_crc(void) sink_crc.fd = igt_debugfs_open("i915_sink_crc_eDP1", O_RDONLY); igt_assert_lte(0, sink_crc.fd); - rc = read(sink_crc.fd, crc.data, SINK_CRC_SIZE); - errno_ = errno; - if (rc == -1 && errno_ == ENOTTY) - igt_info("Sink CRC not supported: panel doesn't support it\n"); - if (rc == -1 && errno_ == ETIMEDOUT) - igt_info("Sink CRC not reliable on this panel: skipping it\n"); - else if (rc == SINK_CRC_SIZE) - sink_crc.supported = true; - else - igt_info("Unexpected sink CRC error, rc=:%zd errno:%d %s\n", - rc, errno_, strerror(errno_)); + /* Do a first read to try to detect if it's supported. */ + get_sink_crc(&crc, false); } static void setup_crcs(void) @@ -1677,9 +1674,9 @@ static int adjust_assertion_flags(const struct test_mode *t, int flags) igt_assert_crc_equal(&crc_.pipe, &wanted_crc->pipe); \ if (mandatory_sink_crc) \ assert_sink_crc_equal(&crc_.sink, &wanted_crc->sink); \ - else \ - if (!sink_crc_equal(&crc_.sink, &wanted_crc->sink)) \ - igt_info("Sink CRC differ, but not required\n"); \ + else if (sink_crc.reliable && \ + !sink_crc_equal(&crc_.sink, &wanted_crc->sink)) \ + igt_info("Sink CRC differ, but not required\n"); \ } while (0) #define do_status_assertions(flags_) do { \