public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jim Bride <jim.bride@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: Refactor to use IGT PSR library functions
Date: Mon, 13 Feb 2017 15:43:28 -0800	[thread overview]
Message-ID: <1487029408-28483-4-git-send-email-jim.bride@linux.intel.com> (raw)
In-Reply-To: <1487029408-28483-1-git-send-email-jim.bride@linux.intel.com>

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Jim Bride <jim.bride@linux.intel.com>
---
 tests/kms_fbcon_fbt.c | 47 +++++++++++------------------------------------
 1 file changed, 11 insertions(+), 36 deletions(-)

diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
index 6342289..a59257b 100644
--- a/tests/kms_fbcon_fbt.c
+++ b/tests/kms_fbcon_fbt.c
@@ -103,8 +103,9 @@ static bool fbc_is_enabled(void)
 	return strstr(buf, "FBC enabled\n");
 }
 
-static bool fbc_wait_until_enabled(void)
+static bool fbc_wait_until_enabled(bool enabled)
 {
+	enabled = enabled;
 	return igt_wait(fbc_is_enabled(), 5000, 1);
 }
 
@@ -147,35 +148,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(void)
-{
-	char buf[256];
-
-	igt_debugfs_read("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(void)
-{
-	char buf[256];
-
-	igt_debugfs_read("i915_edp_psr_status", buf);
-	return strstr(buf, "\nActive: yes\n");
-}
-
-static bool psr_wait_until_enabled(void)
-{
-	return igt_wait(psr_is_enabled(), 5000, 1);
-}
-
 struct feature {
 	bool (*supported_on_chipset)(void);
-	bool (*wait_until_enabled)(void);
+	bool (*wait_until_enabled)(bool status);
 	bool (*connector_possible_fn)(drmModeConnectorPtr connector);
 	const char *param_name;
 } fbc = {
@@ -184,9 +159,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 +185,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());
+	igt_assert(!feature->wait_until_enabled(true));
 
 	set_mode_for_one_screen(&drm, &fb, feature->connector_possible_fn);
 	wait_user("Screen set.");
-	igt_assert(feature->wait_until_enabled());
+	igt_assert(feature->wait_until_enabled(true));
 
 	if (suspend) {
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 		sleep(5);
-		igt_assert(feature->wait_until_enabled());
+		igt_assert(feature->wait_until_enabled(true));
 	}
 
 	igt_remove_fb(drm.fd, &fb);
@@ -230,13 +205,13 @@ static void subtest(struct feature *feature, bool suspend)
 	sleep(3);
 
 	wait_user("Back to fbcon.");
-	igt_assert(!feature->wait_until_enabled());
+	igt_assert(!feature->wait_until_enabled(true));
 
 	if (suspend) {
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 		sleep(5);
-		igt_assert(!feature->wait_until_enabled());
+		igt_assert(!feature->wait_until_enabled(true));
 	}
 }
 
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-02-13 23:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 23:43 [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Jim Bride
2017-02-13 23:43 ` [PATCH I-G-T 2/4] tests/kms_psr_sink_crc: Refactor to use new PSR library primitives Jim Bride
2017-03-23 22:22   ` Vivi, Rodrigo
2017-02-13 23:43 ` [PATCH I-G-T 3/4] tests/kms_frontbuffer_tracking: Refactor to use IGT PSR library functions Jim Bride
2017-03-23 22:22   ` Vivi, Rodrigo
2017-02-13 23:43 ` Jim Bride [this message]
2017-03-23 22:24   ` [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: " Vivi, Rodrigo
2017-03-23 22:20 ` [PATCH I-G-T 1/4] lib: Add PSR utility functions to igt library Vivi, Rodrigo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487029408-28483-4-git-send-email-jim.bride@linux.intel.com \
    --to=jim.bride@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox