[Intel-gfx] [PATCH I-G-T 4/4] tests/kms_fbcon_fbt: Refactor to use IGT PSR library functions

Jim Bride jim.bride at linux.intel.com
Mon Feb 13 23:43:28 UTC 2017


Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
Signed-off-by: Jim Bride <jim.bride at 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



More information about the Intel-gfx mailing list