[Intel-gfx] [PATCH] drm/i915: Allow control of PSR at runtime through debugfs.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Jul 26 12:54:30 UTC 2018


Op 26-07-18 om 08:32 schreef Dhinakaran Pandiyan:
> On Thu, 2018-03-22 at 10:41 +0100, Maarten Lankhorst wrote:
>> Op 22-03-18 om 02:45 schreef Pandiyan, Dhinakaran:
>>> On Thu, 2018-03-15 at 11:28 +0100, Maarten Lankhorst wrote:
>>>> Currently tests modify i915.enable_psr and then do a modeset
>>>> cycle
>>>> to change PSR. We can write a value to i915_edp_psr_status to
>>>> force
>>>> a certain value without a modeset.
>>>>
>>>> To retain compatibility with older userspace, we also still allow
>>>> the override through the module parameter, and add some tracking
>>>> to check whether a debugfs mode is specified.
>>>>
>>> While this is something we want to be able to do, I am concerned
>>> about
>>> adding more complexity to a feature that has barely been tested.
>>>
>>> How about doing a modeset before frontbuffer_tracking PSR subtests
>>> and
>>> one at the end? I'm assuming all of them are grouped together.
>> Currently we run all subtests individually, this means that we also
>> need to do
>> some extra modesets per test. One to disable PSR and collect the
>> reference CRC, the
>> other to enable PSR for the actual test.
>>
>> With these changes, we don't need to do so.
>>
>>
>>> Comments on this patch itself.
>>> 1) please split intel_psr_default_link_standby() into a separate
>>> patch.
>> Will do.
> Maarten, do you plan to rebase this patch? I would like to use this in
> the IGTs to enable PSR1 on PSR2 panels.
I've rebased, can you check it works as intended?

~Maarten

IGT patch below.

----
commit 2ba09dc60dd00c474566fc3d0bb4e550a2c7fcca
Author: Maarten Lankhorst 
Date:   Mon Mar 12 17:49:40 2018 +0100

    tests/kms_frontbuffer_tracking: Add support for toggling edp psr through debugfs, v2.
    
    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 

diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c
index 1dfd7c1cee8d..a043230d150a 100644
--- a/tests/kms_frontbuffer_tracking.c
+++ b/tests/kms_frontbuffer_tracking.c
@@ -775,6 +775,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];
@@ -941,8 +973,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)
 



More information about the Intel-gfx mailing list