From patchwork Fri Jun 30 19:12:24 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: 9820283 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 7EFE960224 for ; Fri, 30 Jun 2017 19:14:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 716CA28478 for ; Fri, 30 Jun 2017 19:14:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6644C28694; Fri, 30 Jun 2017 19:14:59 +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 0F4EF28478 for ; Fri, 30 Jun 2017 19:14:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 572586E85F; Fri, 30 Jun 2017 19:14:58 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 528776E85E for ; Fri, 30 Jun 2017 19:14:54 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 30 Jun 2017 12:14:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,288,1496127600"; d="scan'208";a="280775241" Received: from shiv.jf.intel.com ([10.54.75.141]) by fmsmga004.fm.intel.com with ESMTP; 30 Jun 2017 12:14:53 -0700 From: Jim Bride To: intel-gfx@lists.freedesktop.org Date: Fri, 30 Jun 2017 12:12:24 -0700 Message-Id: <1498849944-26404-7-git-send-email-jim.bride@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498849944-26404-1-git-send-email-jim.bride@linux.intel.com> References: <1498849944-26404-1-git-send-email-jim.bride@linux.intel.com> Cc: Paulo Zanoni , Rodrigo Vivi Subject: [Intel-gfx] [PATCH IGT v2 6/6] tests/kms_fbcon_fbt: 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 v2: * Minor functional tweaks and bug fixes * Rebase Cc: Rodrigo Vivi Cc: Paulo Zanoni Signed-off-by: Jim Bride --- tests/kms_fbcon_fbt.c | 54 +++++++++++++++++---------------------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c index d009091..593adb9 100644 --- a/tests/kms_fbcon_fbt.c +++ b/tests/kms_fbcon_fbt.c @@ -103,8 +103,9 @@ static bool fbc_is_enabled(int fd) return strstr(buf, "FBC enabled\n"); } -static bool fbc_wait_until_enabled(int fd) +static bool fbc_wait_until_enabled(int fd, bool enabled) { + enabled = enabled; return igt_wait(fbc_is_enabled(fd), 5000, 1); } @@ -124,6 +125,13 @@ static void set_mode_for_one_screen(struct drm_info *drm, struct igt_fb *fb, if (c->connection == DRM_MODE_CONNECTED && c->count_modes && connector_possible(c)) { + if (c->connector_type == DRM_MODE_CONNECTOR_eDP) { + bool bret; + + bret = igt_psr_find_good_mode(c, &mode); + if (bret) + break; + } mode = &c->modes[0]; break; } @@ -147,35 +155,9 @@ static void set_mode_for_one_screen(struct drm_info *drm, struct igt_fb *fb, igt_assert_eq(rc, 0); } -static bool psr_supported_on_chipset(int fd) -{ - char buf[256]; - - igt_debugfs_read(fd, "i915_edp_psr_status", buf); - return strstr(buf, "Sink_Support: yes\n"); -} - -static bool connector_can_psr(drmModeConnectorPtr connector) -{ - return (connector->connector_type == DRM_MODE_CONNECTOR_eDP); -} - -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"); -} - -static bool psr_wait_until_enabled(int fd) -{ - return igt_wait(psr_is_enabled(fd), 5000, 1); -} - struct feature { bool (*supported_on_chipset)(int fd); - bool (*wait_until_enabled)(int fd); + bool (*wait_until_enabled)(int fd, bool status); bool (*connector_possible_fn)(drmModeConnectorPtr connector); const char *param_name; } fbc = { @@ -184,9 +166,9 @@ struct feature { .connector_possible_fn = connector_can_fbc, .param_name = "enable_fbc", }, psr = { - .supported_on_chipset = psr_supported_on_chipset, - .wait_until_enabled = psr_wait_until_enabled, - .connector_possible_fn = connector_can_psr, + .supported_on_chipset = igt_psr_sink_support, + .wait_until_enabled = igt_psr_await_status, + .connector_possible_fn = igt_psr_valid_connector, .param_name = "enable_psr", }; @@ -210,17 +192,17 @@ static void subtest(struct feature *feature, bool suspend) kmstest_unset_all_crtcs(drm.fd, drm.res); wait_user("Modes unset."); - igt_assert(!feature->wait_until_enabled(drm.fd)); + igt_assert(!feature->wait_until_enabled(drm.fd, true)); set_mode_for_one_screen(&drm, &fb, feature->connector_possible_fn); wait_user("Screen set."); - igt_assert(feature->wait_until_enabled(drm.fd)); + igt_assert(feature->wait_until_enabled(drm.fd, true)); if (suspend) { igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); sleep(5); - igt_assert(feature->wait_until_enabled(drm.fd)); + igt_assert(feature->wait_until_enabled(drm.fd, true)); } igt_remove_fb(drm.fd, &fb); @@ -230,13 +212,13 @@ static void subtest(struct feature *feature, bool suspend) sleep(3); wait_user("Back to fbcon."); - igt_assert(!feature->wait_until_enabled(drm.fd)); + igt_assert(!feature->wait_until_enabled(drm.fd, true)); if (suspend) { igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); sleep(5); - igt_assert(!feature->wait_until_enabled(drm.fd)); + igt_assert(!feature->wait_until_enabled(drm.fd, true)); } }