From patchwork Thu Dec 22 20:42:05 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: 9485629 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 D63E960405 for ; Thu, 22 Dec 2016 20:42:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8FE027D85 for ; Thu, 22 Dec 2016 20:42:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBD8D27F99; Thu, 22 Dec 2016 20:42:43 +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 7860C27D85 for ; Thu, 22 Dec 2016 20:42:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 414F36F397; Thu, 22 Dec 2016 20:42:41 +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 9E9496F396 for ; Thu, 22 Dec 2016 20:42:17 +0000 (UTC) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP; 22 Dec 2016 12:42:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,390,1477983600"; d="scan'208";a="42582940" Received: from przanoni-mobl.amr.corp.intel.com ([10.254.184.18]) by orsmga004.jf.intel.com with ESMTP; 22 Dec 2016 12:42:16 -0800 From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Thu, 22 Dec 2016 18:42:05 -0200 Message-Id: <1482439328-32197-3-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 3/6] kms_frontbuffer_tracking: move more code to get_sink_crc() 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 Make it check for the supported flag and decide what to do. This change will make the next patches much easier, and it's probably better to move more sink CRC logic to the sink CRC function. Signed-off-by: Paulo Zanoni --- tests/kms_frontbuffer_tracking.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index 81532dc..4a46942 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -933,6 +933,11 @@ static void get_sink_crc(sink_crc_t *crc, bool mandatory) { int rc, errno_; + if (!sink_crc.supported) { + memcpy(crc, "unsupported!", SINK_CRC_SIZE); + return; + } + lseek(sink_crc.fd, 0, SEEK_SET); rc = read(sink_crc.fd, crc->data, SINK_CRC_SIZE); @@ -1220,11 +1225,7 @@ static void print_crc(const char *str, struct both_crcs *crc) static void collect_crcs(struct both_crcs *crcs, bool mandatory_sink_crc) { igt_pipe_crc_collect_crc(pipe_crc, &crcs->pipe); - - if (sink_crc.supported) - get_sink_crc(&crcs->sink, mandatory_sink_crc); - else - memcpy(&crcs->sink, "unsupported!", SINK_CRC_SIZE); + get_sink_crc(&crcs->sink, mandatory_sink_crc); } static void init_blue_crc(enum pixel_format format, bool mandatory_sink_crc)