[PATCH 16/31] drm/{i915, xe}: Move power_domains suspend/resume to display_power

Cavitt, Jonathan jonathan.cavitt at intel.com
Mon Oct 7 21:25:25 UTC 2024


-----Original Message-----
From: Intel-gfx <intel-gfx-bounces at lists.freedesktop.org> On Behalf Of Rodrigo Vivi
Sent: Tuesday, September 24, 2024 1:36 PM
To: intel-gfx at lists.freedesktop.org; intel-xe at lists.freedesktop.org
Cc: Deak, Imre <imre.deak at intel.com>; Vivi, Rodrigo <rodrigo.vivi at intel.com>
Subject: [PATCH 16/31] drm/{i915, xe}: Move power_domains suspend/resume to display_power
> 
> Move intel_power_domains_{suspend,resume} to inside
> intel_display_power_{suspend_late, resume_early}.
> 
> With this also change the VLV suspend failure to call
> the intel_display_power_resume_early. In the end, the only
> function executed there for VLV is the intel_power_domains_resume.
> Besides make the code more consistency give the call that was
> immediately before: intel_display_power_suspend_late.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

Debatably, this should be done the other way around: Instead of
putting intel_power_domains_resume as the last part of running
intel_display_power_resume_early, we should be making
intel_display_power_resume_early the first part of running
intel_power_domains_resume.  Same with
intel_power_domains_suspend and its relation to
intel_display_power_suspend_late.

Also, this patch may want to be split in two (for i915 and xe).

But I'll trust your judgement here.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt

> ---
>  drivers/gpu/drm/i915/display/intel_display_power.c | 6 +++++-
>  drivers/gpu/drm/i915/display/intel_display_power.h | 2 +-
>  drivers/gpu/drm/i915/i915_driver.c                 | 8 ++------
>  drivers/gpu/drm/xe/display/xe_display.c            | 7 ++-----
>  4 files changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c
> index ecabb674644b..923178a4ffe5 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.c
> @@ -2231,10 +2231,12 @@ static void intel_power_domains_verify_state(struct drm_i915_private *i915)
>  
>  #endif
>  
> -void intel_display_power_suspend_late(struct drm_i915_private *i915)
> +void intel_display_power_suspend_late(struct drm_i915_private *i915, bool s2idle)
>  {
>  	struct intel_display *display = &i915->display;
>  
> +	intel_power_domains_suspend(i915, s2idle);
> +
>  	if (DISPLAY_VER(i915) >= 11 || IS_GEMINILAKE(i915) ||
>  	    IS_BROXTON(i915)) {
>  		bxt_enable_dc9(display);
> @@ -2262,6 +2264,8 @@ void intel_display_power_resume_early(struct drm_i915_private *i915)
>  	/* Tweaked Wa_14010685332:cnp,icp,jsp,mcc,tgp,adp */
>  	if (INTEL_PCH_TYPE(i915) >= PCH_CNP && INTEL_PCH_TYPE(i915) < PCH_DG1)
>  		intel_de_rmw(i915, SOUTH_CHICKEN1, SBCLK_RUN_REFCLK_DIS, 0);
> +
> +	intel_power_domains_resume(i915);
>  }
>  
>  void intel_display_power_suspend(struct drm_i915_private *i915)
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h b/drivers/gpu/drm/i915/display/intel_display_power.h
> index 425452c5a469..ccac3c06b2f7 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.h
> @@ -176,7 +176,7 @@ void intel_power_domains_suspend(struct drm_i915_private *dev_priv, bool s2idle)
>  void intel_power_domains_resume(struct drm_i915_private *dev_priv);
>  void intel_power_domains_sanitize_state(struct drm_i915_private *dev_priv);
>  
> -void intel_display_power_suspend_late(struct drm_i915_private *i915);
> +void intel_display_power_suspend_late(struct drm_i915_private *i915, bool s2idle);
>  void intel_display_power_resume_early(struct drm_i915_private *i915);
>  void intel_display_power_suspend(struct drm_i915_private *i915);
>  void intel_display_power_resume(struct drm_i915_private *i915);
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index c9df361f898f..9e788e1c178e 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1034,14 +1034,12 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
>  	for_each_gt(gt, dev_priv, i)
>  		intel_uncore_suspend(gt->uncore);
>  
> -	intel_power_domains_suspend(dev_priv, s2idle);
> -
> -	intel_display_power_suspend_late(dev_priv);
> +	intel_display_power_suspend_late(dev_priv, s2idle);
>  
>  	ret = vlv_suspend_complete(dev_priv);
>  	if (ret) {
>  		drm_err(&dev_priv->drm, "Suspend complete failed: %d\n", ret);
> -		intel_power_domains_resume(dev_priv);
> +		intel_display_power_resume_early(dev_priv);
>  
>  		goto out;
>  	}
> @@ -1211,8 +1209,6 @@ static int i915_drm_resume_early(struct drm_device *dev)
>  
>  	intel_display_power_resume_early(dev_priv);
>  
> -	intel_power_domains_resume(dev_priv);
> -
>  	enable_rpm_wakeref_asserts(&dev_priv->runtime_pm);
>  
>  	return ret;
> diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> index e5df50221a04..d5be622f831b 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.c
> +++ b/drivers/gpu/drm/xe/display/xe_display.c
> @@ -404,12 +404,11 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
>  void xe_display_pm_suspend_late(struct xe_device *xe)
>  {
>  	bool s2idle = suspend_to_idle();
> +
>  	if (!xe->info.probe_display)
>  		return;
>  
> -	intel_power_domains_suspend(xe, s2idle);
> -
> -	intel_display_power_suspend_late(xe);
> +	intel_display_power_suspend_late(xe, s2idle);
>  }
>  
>  void xe_display_pm_resume_early(struct xe_device *xe)
> @@ -418,8 +417,6 @@ void xe_display_pm_resume_early(struct xe_device *xe)
>  		return;
>  
>  	intel_display_power_resume_early(xe);
> -
> -	intel_power_domains_resume(xe);
>  }
>  
>  void xe_display_pm_resume(struct xe_device *xe)
> -- 
> 2.46.0
> 
> 


More information about the Intel-gfx mailing list