From patchwork Mon Feb 13 23:43:27 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: 9570881 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 ACA6B60572 for ; Mon, 13 Feb 2017 23:45:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A155327F85 for ; Mon, 13 Feb 2017 23:45:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94C9628178; Mon, 13 Feb 2017 23:45:12 +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 195B727F85 for ; Mon, 13 Feb 2017 23:45:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D45606E58C; Mon, 13 Feb 2017 23:45:10 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C4936E58D for ; Mon, 13 Feb 2017 23:45:10 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 13 Feb 2017 15:45:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,158,1484035200"; d="scan'208";a="933496867" Received: from shiv.jf.intel.com ([10.7.198.83]) by orsmga003.jf.intel.com with ESMTP; 13 Feb 2017 15:45:09 -0800 From: Jim Bride To: intel-gfx@lists.freedesktop.org Date: Mon, 13 Feb 2017 15:43:27 -0800 Message-Id: <1487029408-28483-3-git-send-email-jim.bride@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487029408-28483-1-git-send-email-jim.bride@linux.intel.com> References: <1487029408-28483-1-git-send-email-jim.bride@linux.intel.com> Cc: Paulo Zanoni , Rodrigo Vivi Subject: [Intel-gfx] [PATCH I-G-T 3/4] tests/kms_frontbuffer_tracking: Refactor to use IGT PSR library functions 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 Cc: Rodrigo Vivi Cc: Paulo Zanoni Signed-off-by: Jim Bride Reviewed-by: Rodrigo Vivi --- tests/kms_frontbuffer_tracking.c | 47 ++++++++-------------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index 4f4848b..91376e4 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -793,23 +793,6 @@ static void fbc_print_status(void) igt_info("FBC status:\n%s\n", buf); } -static bool psr_is_enabled(void) -{ - char buf[256]; - - igt_debugfs_read("i915_edp_psr_status", buf); - return strstr(buf, "\nActive: yes\n") && - strstr(buf, "\nHW Enabled & Active bit: yes\n"); -} - -static void psr_print_status(void) -{ - char buf[256]; - - igt_debugfs_read("i915_edp_psr_status", buf); - igt_info("PSR status:\n%s\n", buf); -} - static struct timespec fbc_get_last_action(void) { struct timespec ret = { 0, 0 }; @@ -915,15 +898,8 @@ static bool fbc_wait_until_enabled(void) return igt_wait(fbc_is_enabled(), 2000, 1); } -static bool psr_wait_until_enabled(void) -{ - return igt_wait(psr_is_enabled(), 5000, 1); -} - #define fbc_enable() igt_set_module_param_int("enable_fbc", 1) #define fbc_disable() igt_set_module_param_int("enable_fbc", 0) -#define psr_enable() igt_set_module_param_int("enable_psr", 1) -#define psr_disable() igt_set_module_param_int("enable_psr", 0) static void get_sink_crc(sink_crc_t *crc, bool mandatory) { @@ -1169,7 +1145,7 @@ static void disable_features(const struct test_mode *t) return; fbc_disable(); - psr_disable(); + igt_psr_disable(); } static void *busy_thread_func(void *data) @@ -1529,14 +1505,6 @@ static void teardown_fbc(void) { } -static bool psr_sink_has_support(void) -{ - char buf[256]; - - igt_debugfs_read("i915_edp_psr_status", buf); - return strstr(buf, "Sink_Support: yes\n"); -} - static void setup_psr(void) { if (get_connector(prim_mode_params.connector_id)->connector_type != @@ -1545,7 +1513,7 @@ static void setup_psr(void) return; } - if (!psr_sink_has_support()) { + if (!igt_psr_sink_support()) { igt_info("Can't test PSR: not supported by sink.\n"); return; } @@ -1699,12 +1667,15 @@ static int adjust_assertion_flags(const struct test_mode *t, int flags) } \ \ if (flags_ & ASSERT_PSR_ENABLED) { \ - if (!psr_wait_until_enabled()) { \ - psr_print_status(); \ + if (!igt_psr_await_status(true)) { \ + igt_psr_print_status(); \ igt_assert_f(false, "PSR disabled\n"); \ } \ } else if (flags_ & ASSERT_PSR_DISABLED) { \ - igt_assert(!psr_wait_until_enabled()); \ + if (!igt_psr_await_status(false)) { \ + igt_psr_print_status(); \ + igt_assert_f(false, "PSR enabled\n"); \ + } \ } \ } while (0) @@ -1804,7 +1775,7 @@ static void enable_features_for_test(const struct test_mode *t) if (t->feature & FEATURE_FBC) fbc_enable(); if (t->feature & FEATURE_PSR) - psr_enable(); + igt_psr_enable(); } static void check_test_requirements(const struct test_mode *t)