[igt-dev] [PATCH i-g-t 4/5] tests/kms_frontbuffer_tracking: Add support for toggling edp psr through debugfs.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Mon Mar 12 17:30:12 UTC 2018


It's harmful to write to enable_psr at runtime, and the patch that allows
us to change i915_edp_psr_status with the panel running will require us
to abandon the module parameter. Hence the userspace change needs to be
put in IGT first before we can change it at kernel time.

Toggling it to debugfs will mean we can skip a modeset when changing our
feature set.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_frontbuffer_tracking.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 000f54eef408..7fe392bc0a08 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -799,11 +799,29 @@ static void drrs_set(int val)
 		igt_assert_f(ret == (sizeof(buf) - 1), "debugfs_write failed");
 }
 
+static void restore_psr_debugfs(int sig)
+{
+	debugfs_write("i915_edp_psr_status", "-1");
+}
+
 static bool psr_set(int val)
 {
-	int oldval;
+	char buf[4];
+	int ret, oldval;
 	static int default_psr = -1;
 
+	snprintf(buf, sizeof(buf), "%i\n", val);
+
+	ret = debugfs_write("i915_edp_psr_status", buf);
+	if (ret != -EINVAL) {
+		igt_assert(ret > 0 || val <= 0);
+
+		if (ret > 0)
+			igt_install_exit_handler(restore_psr_debugfs);
+
+		return false;
+	}
+
 	oldval = igt_get_module_param_int("enable_psr");
 	if (default_psr == -1)
 		default_psr = oldval;
-- 
2.16.2



More information about the igt-dev mailing list