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

Jim Bride jim.bride at linux.intel.com
Mon Feb 13 23:43:27 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_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)
-- 
2.7.4



More information about the Intel-gfx mailing list