[igt-dev] [PATCH i-g-t 1/2] tests/kms_frontbuffer_tracking: Add support for toggling edp psr through debugfs, v2.
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Mon Mar 19 15:04:10 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.
Changes since v1:
- Rebase with the previous patches dropped.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
tests/kms_frontbuffer_tracking.c | 36 ++++++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 2b85392dfa4b..5d619f211725 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -811,6 +811,38 @@ static void drrs_set(unsigned 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(unsigned int val)
+{
+ static int oldval = -1;
+ char buf[4];
+ int ret;
+
+ 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;
+ }
+
+ igt_set_module_param_int("enable_psr", val);
+
+ if (val == oldval)
+ return false;
+
+ oldval = val;
+ return true;
+}
+
static bool is_drrs_high(void)
{
char buf[MAX_DRRS_STATUS_BUF_LEN];
@@ -979,8 +1011,8 @@ static bool drrs_wait_until_rr_switch_to_low(void)
#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)
+#define psr_enable() psr_set(1)
+#define psr_disable() psr_set(0)
#define drrs_enable() drrs_set(1)
#define drrs_disable() drrs_set(0)
--
2.16.2
More information about the igt-dev
mailing list