From patchwork Tue Jul 11 22:48:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jim.bride@linux.intel.com X-Patchwork-Id: 9835629 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 5BE29602BD for ; Tue, 11 Jul 2017 22:51:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41A14285C8 for ; Tue, 11 Jul 2017 22:51:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 363DA285C3; Tue, 11 Jul 2017 22:51:23 +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 B74D2285C8 for ; Tue, 11 Jul 2017 22:51:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9EEE36E33D; Tue, 11 Jul 2017 22:51:14 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id C8E436E322 for ; Tue, 11 Jul 2017 22:51:07 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2017 15:51:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,347,1496127600"; d="scan'208";a="123996632" Received: from shiv.jf.intel.com ([10.54.75.141]) by orsmga005.jf.intel.com with ESMTP; 11 Jul 2017 15:51:06 -0700 From: Jim Bride To: intel-gfx@lists.freedesktop.org Date: Tue, 11 Jul 2017 15:48:31 -0700 Message-Id: <1499813316-15038-7-git-send-email-jim.bride@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499813316-15038-1-git-send-email-jim.bride@linux.intel.com> References: <1499813316-15038-1-git-send-email-jim.bride@linux.intel.com> Subject: [Intel-gfx] [PATCH IGT 06/11] lib: Add function to return PSR active status 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 Add igt_psr_active() which returns whether PSR is active or not and modify tests to use this function. Signed-off-by: Jim Bride --- lib/igt_psr.c | 19 +++++++++++++++++++ lib/igt_psr.h | 1 + tests/kms_fbcon_fbt.c | 5 +---- tests/kms_frontbuffer_tracking.c | 6 +----- tests/kms_psr_sink_crc.c | 5 +---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/igt_psr.c b/lib/igt_psr.c index c5c9b4c..d849961 100644 --- a/lib/igt_psr.c +++ b/lib/igt_psr.c @@ -83,3 +83,22 @@ bool igt_psr_possible(int fd) return igt_psr_source_support(fd) && igt_psr_sink_support(fd); } + +/** + * igt_psr_active: + * + * Returns true if PSR is active on the panel. + */ +bool igt_psr_active(int fd) +{ + char buf[BUFSIZE]; + bool actret = false; + bool hwactret = false; + + igt_debugfs_read(fd, "i915_edp_psr_status", buf); + hwactret = (strstr(buf, "HW Enabled & Active bit: yes\n") != NULL); + actret = (strstr(buf, "Active: yes\n") != NULL); + igt_debug("hwactret: %s actret: %s\n", hwactret ? "true" : "false", + actret ? "true" : "false"); + return hwactret && actret; +} diff --git a/lib/igt_psr.h b/lib/igt_psr.h index 98774c8..b678329 100644 --- a/lib/igt_psr.h +++ b/lib/igt_psr.h @@ -30,5 +30,6 @@ bool igt_psr_source_support(int fd); bool igt_psr_sink_support(int fd); bool igt_psr_possible(int fd); +bool igt_psr_active(int fd); #endif /* IGT_PSR_H */ diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c index d0ed9f5..41ab36d 100644 --- a/tests/kms_fbcon_fbt.c +++ b/tests/kms_fbcon_fbt.c @@ -159,10 +159,7 @@ static bool connector_can_psr(drmModeConnectorPtr connector) static bool psr_is_enabled(int fd) { - char buf[256]; - - igt_debugfs_read(fd, "i915_edp_psr_status", buf); - return strstr(buf, "\nActive: yes\n"); + return igt_psr_active(fd); } static bool psr_wait_until_enabled(int fd) diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index 347dcc1..b202297 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -800,11 +800,7 @@ static void fbc_print_status(void) static bool psr_is_enabled(void) { - char buf[256]; - - debugfs_read("i915_edp_psr_status", buf); - return strstr(buf, "\nActive: yes\n") && - strstr(buf, "\nHW Enabled & Active bit: yes\n"); + return igt_psr_active(drm.fd); } static void psr_print_status(void) diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c index 952a109..0c27fc7 100644 --- a/tests/kms_psr_sink_crc.c +++ b/tests/kms_psr_sink_crc.c @@ -200,12 +200,9 @@ static bool psr_possible(data_t *data) static bool psr_active(data_t *data) { - char buf[512]; - - igt_debugfs_read(data->drm_fd, "i915_edp_psr_status", buf); return running_with_psr_disabled || - strstr(buf, "HW Enabled & Active bit: yes\n"); + igt_psr_active(data->drm_fd); } static bool wait_psr_entry(data_t *data)