diff mbox series

[v8,05/20] drm/i915/psr: Disable Panel Replay if PSR mode is set via module parameter

Message ID 20240613093239.1293629-6-jouni.hogander@intel.com (mailing list archive)
State New, archived
Headers show
Series Panel Replay eDP support | expand

Commit Message

Hogander, Jouni June 13, 2024, 9:32 a.m. UTC
If enable_psr module parameter is set as disabled, PSR1 or PSR2: Panel
Replay is disabled.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 .../gpu/drm/i915/display/intel_display_params.c  |  3 +--
 drivers/gpu/drm/i915/display/intel_psr.c         | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

Comments

Manna, Animesh June 14, 2024, 4:54 p.m. UTC | #1
> -----Original Message-----
> From: Hogander, Jouni <jouni.hogander@intel.com>
> Sent: Thursday, June 13, 2024 3:02 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Manna, Animesh <animesh.manna@intel.com>; Kahola, Mika
> <mika.kahola@intel.com>; Hogander, Jouni <jouni.hogander@intel.com>
> Subject: [PATCH v8 05/20] drm/i915/psr: Disable Panel Replay if PSR mode is
> set via module parameter
> 
> If enable_psr module parameter is set as disabled, PSR1 or PSR2: Panel
> Replay is disabled.

This patch is modifying the way how to enable/disable panel-replay/psr/psr2 through kernel cmdline.
Good to have little more detailed commit description. Patch commit title and description is different but agree are true.

> 
> Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  .../gpu/drm/i915/display/intel_display_params.c  |  3 +--
>  drivers/gpu/drm/i915/display/intel_psr.c         | 16 ++++++++++++++++
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_params.c
> b/drivers/gpu/drm/i915/display/intel_display_params.c
> index aebdb7b59dbf..79107607a6ff 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_params.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_params.c
> @@ -106,8 +106,7 @@ intel_display_param_named_unsafe(enable_fbc, int,
> 0400,
> 
>  intel_display_param_named_unsafe(enable_psr, int, 0400,
>  	"Enable PSR "
> -	"(0=disabled, 1=enable up to PSR1 and Panel Replay full frame
> update, "
> -	"2=enable up to PSR2 and Panel Replay Selective Update) "
> +	"(0=disabled, 1=enable up to PSR1, 2=enable up to PSR2) "
>  	"Default: -1 (use per-chip default)");
> 
>  intel_display_param_named(psr_safest_params, bool, 0400, diff --git
> a/drivers/gpu/drm/i915/display/intel_psr.c
> b/drivers/gpu/drm/i915/display/intel_psr.c
> index f8e746e476e9..0df557676e08 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -235,6 +235,15 @@ static bool psr2_global_enabled(struct intel_dp
> *intel_dp)
>  	}
>  }
> 
> +static bool panel_replay_global_enabled(struct intel_dp *intel_dp) {
> +	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> +
> +	if (i915->display.params.enable_psr != -1)
> +		return false;
> +	return true;
> +}
> +
>  static u32 psr_irq_psr_error_bit_get(struct intel_dp *intel_dp)  {
>  	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); @@ -
> 1457,9 +1466,16 @@ static bool _psr_compute_config(struct intel_dp
> *intel_dp,
> 
>  static bool _panel_replay_compute_config(struct intel_dp *intel_dp)  {
> +	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> +
>  	if (!CAN_PANEL_REPLAY(intel_dp))
>  		return false;
> 
> +	if (!panel_replay_global_enabled(intel_dp)) {
> +		drm_dbg_kms(&i915->drm, "Panel Replay disabled by flag\n");
> +		return false;
> +	}

Just a nitpick: Maybe can add an extra debug print like below,

	if (!panel_replay_global_enabled(intel_dp)) {
		if (i915->display.params.enable_psr)
			drm_dbg_kms(&i915->drm, "Panel Replay disabled as PSR is enabled\n");
		else
			drm_dbg_kms(&i915->drm, "Panel Replay disabled by flag\n");
		return false;
	}

Regards,
Animesh

> +
>  	return true;
>  }
> 
> --
> 2.34.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_params.c b/drivers/gpu/drm/i915/display/intel_display_params.c
index aebdb7b59dbf..79107607a6ff 100644
--- a/drivers/gpu/drm/i915/display/intel_display_params.c
+++ b/drivers/gpu/drm/i915/display/intel_display_params.c
@@ -106,8 +106,7 @@  intel_display_param_named_unsafe(enable_fbc, int, 0400,
 
 intel_display_param_named_unsafe(enable_psr, int, 0400,
 	"Enable PSR "
-	"(0=disabled, 1=enable up to PSR1 and Panel Replay full frame update, "
-	"2=enable up to PSR2 and Panel Replay Selective Update) "
+	"(0=disabled, 1=enable up to PSR1, 2=enable up to PSR2) "
 	"Default: -1 (use per-chip default)");
 
 intel_display_param_named(psr_safest_params, bool, 0400,
diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index f8e746e476e9..0df557676e08 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -235,6 +235,15 @@  static bool psr2_global_enabled(struct intel_dp *intel_dp)
 	}
 }
 
+static bool panel_replay_global_enabled(struct intel_dp *intel_dp)
+{
+	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+
+	if (i915->display.params.enable_psr != -1)
+		return false;
+	return true;
+}
+
 static u32 psr_irq_psr_error_bit_get(struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
@@ -1457,9 +1466,16 @@  static bool _psr_compute_config(struct intel_dp *intel_dp,
 
 static bool _panel_replay_compute_config(struct intel_dp *intel_dp)
 {
+	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+
 	if (!CAN_PANEL_REPLAY(intel_dp))
 		return false;
 
+	if (!panel_replay_global_enabled(intel_dp)) {
+		drm_dbg_kms(&i915->drm, "Panel Replay disabled by flag\n");
+		return false;
+	}
+
 	return true;
 }