diff mbox series

[2/2] drm/i915/display: Add warn_on in intel_psr_pause()

Message ID 20211020003558.222198-2-jose.souza@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/display: Rename POWER_DOMAIN_DPLL_DC_OFF to POWER_DOMAIN_DC_OFF | expand

Commit Message

Souza, Jose Oct. 20, 2021, 12:35 a.m. UTC
Right now the only user of psr_pause/resume is intel_cdclk but
additional users will be added in the future and we may need
do reference counting for PSR pause and resume, for now only adding a
warn_on so this cases do not go unnoticed.

Cc: Mika Kahola <mika.kahola@intel.com>
Cc: Jouni Hogander <jouni.hogander@intel.com>
Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Mika Kahola Oct. 20, 2021, 11:28 a.m. UTC | #1
> -----Original Message-----
> From: Souza, Jose <jose.souza@intel.com>
> Sent: Wednesday, October 20, 2021 3:36 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: Kahola, Mika <mika.kahola@intel.com>; Hogander, Jouni
> <jouni.hogander@intel.com>; Sripada, Radhakrishna
> <radhakrishna.sripada@intel.com>; Souza, Jose <jose.souza@intel.com>
> Subject: [PATCH 2/2] drm/i915/display: Add warn_on in intel_psr_pause()
> 
> Right now the only user of psr_pause/resume is intel_cdclk but additional users
> will be added in the future and we may need do reference counting for PSR
> pause and resume, for now only adding a warn_on so this cases do not go
> unnoticed.
> 
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Jouni Hogander <jouni.hogander@intel.com>
> Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>

For the time being, the warn_on seems a valid addition to remind us about these cases.

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> b/drivers/gpu/drm/i915/display/intel_psr.c
> index 7a205fd5023bb..49c2dfbd40554 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1346,6 +1346,7 @@ void intel_psr_disable(struct intel_dp *intel_dp,
>   */
>  void intel_psr_pause(struct intel_dp *intel_dp)  {
> +	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
>  	struct intel_psr *psr = &intel_dp->psr;
> 
>  	if (!CAN_PSR(intel_dp))
> @@ -1358,6 +1359,9 @@ void intel_psr_pause(struct intel_dp *intel_dp)
>  		return;
>  	}
> 
> +	/* If we ever hit this, we will need to add refcount to pause/resume */
> +	drm_WARN_ON(&dev_priv->drm, psr->paused);
> +
>  	intel_psr_exit(intel_dp);
>  	intel_psr_wait_exit_locked(intel_dp);
>  	psr->paused = true;
> --
> 2.33.1
Yokoyama, Caz Oct. 20, 2021, 3:15 p.m. UTC | #2
On Tue, 2021-10-19 at 17:35 -0700, José Roberto de Souza wrote:
> Right now the only user of psr_pause/resume is intel_cdclk but
> additional users will be added in the future and we may need
> do reference counting for PSR pause and resume, for now only adding a
do -> to do?

> warn_on so this cases do not go unnoticed.
> 
> Cc: Mika Kahola <mika.kahola@intel.com>
> Cc: Jouni Hogander <jouni.hogander@intel.com>
> Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_psr.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_psr.c
> b/drivers/gpu/drm/i915/display/intel_psr.c
> index 7a205fd5023bb..49c2dfbd40554 100644
> --- a/drivers/gpu/drm/i915/display/intel_psr.c
> +++ b/drivers/gpu/drm/i915/display/intel_psr.c
> @@ -1346,6 +1346,7 @@ void intel_psr_disable(struct intel_dp
> *intel_dp,
>   */
>  void intel_psr_pause(struct intel_dp *intel_dp)
>  {
> +	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
Do you need to define? It is used once.
-caz

>  	struct intel_psr *psr = &intel_dp->psr;
>  
>  	if (!CAN_PSR(intel_dp))
> @@ -1358,6 +1359,9 @@ void intel_psr_pause(struct intel_dp *intel_dp)
>  		return;
>  	}
>  
> +	/* If we ever hit this, we will need to add refcount to
> pause/resume */
> +	drm_WARN_ON(&dev_priv->drm, psr->paused);
> +
>  	intel_psr_exit(intel_dp);
>  	intel_psr_wait_exit_locked(intel_dp);
>  	psr->paused = true;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_psr.c b/drivers/gpu/drm/i915/display/intel_psr.c
index 7a205fd5023bb..49c2dfbd40554 100644
--- a/drivers/gpu/drm/i915/display/intel_psr.c
+++ b/drivers/gpu/drm/i915/display/intel_psr.c
@@ -1346,6 +1346,7 @@  void intel_psr_disable(struct intel_dp *intel_dp,
  */
 void intel_psr_pause(struct intel_dp *intel_dp)
 {
+	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
 	struct intel_psr *psr = &intel_dp->psr;
 
 	if (!CAN_PSR(intel_dp))
@@ -1358,6 +1359,9 @@  void intel_psr_pause(struct intel_dp *intel_dp)
 		return;
 	}
 
+	/* If we ever hit this, we will need to add refcount to pause/resume */
+	drm_WARN_ON(&dev_priv->drm, psr->paused);
+
 	intel_psr_exit(intel_dp);
 	intel_psr_wait_exit_locked(intel_dp);
 	psr->paused = true;