Re: [PATCH 04/31] drm/i915/display: Move shutdown sequences under display driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 24, 2024 at 04:35:25PM -0400, Rodrigo Vivi wrote:
> Move display related shutdown sequences from i915_driver to
> intel_display_driver.
> 
> No functional change. Just taking the right ownership and
> start some reconciliation of them between i915 and Xe.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
> ---
>  .../drm/i915/display/intel_display_driver.c   | 40 +++++++++++++++++++
>  .../drm/i915/display/intel_display_driver.h   |  3 ++
>  drivers/gpu/drm/i915/i915_driver.c            | 29 ++------------
>  3 files changed, 47 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
> index c106fb2dd20b..e40b1105168e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> @@ -39,6 +39,7 @@
>  #include "intel_dp_tunnel.h"
>  #include "intel_dpll.h"
>  #include "intel_dpll_mgr.h"
> +#include "intel_encoder.h"
>  #include "intel_fb.h"
>  #include "intel_fbc.h"
>  #include "intel_fbdev.h"
> @@ -755,3 +756,42 @@ void intel_display_driver_resume(struct drm_i915_private *i915)
>  	if (state)
>  		drm_atomic_state_put(state);
>  }
> +
> +void intel_display_driver_shutdown(struct drm_i915_private *i915)
> +{
> +	intel_power_domains_disable(i915);
> +
> +	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
> +	if (HAS_DISPLAY(i915)) {
> +		drm_kms_helper_poll_disable(&i915->drm);
> +		intel_display_driver_disable_user_access(i915);
> +
> +		drm_atomic_helper_shutdown(&i915->drm);
> +	}
> +
> +	intel_dp_mst_suspend(i915);
> +}
> +
> +void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915)
> +{
> +	intel_hpd_cancel_work(i915);
> +
> +	if (HAS_DISPLAY(i915))
> +		intel_display_driver_suspend_access(i915);
> +
> +	intel_encoder_suspend_all(&i915->display);
> +	intel_encoder_shutdown_all(&i915->display);
> +
> +	intel_dmc_suspend(&i915->display);
> +}
> +
> +void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915)
> +{
> +	/*
> +	 * The only requirement is to reboot with display DC states disabled,
> +	 * for now leaving all display power wells in the INIT power domain
> +	 * enabled.
> +	 */
> +
> +	intel_power_domains_driver_remove(i915);
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.h b/drivers/gpu/drm/i915/display/intel_display_driver.h
> index 42cc4af6d3fd..1ee37fb58d38 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.h
> @@ -26,6 +26,9 @@ void intel_display_driver_remove_nogem(struct drm_i915_private *i915);
>  void intel_display_driver_unregister(struct drm_i915_private *i915);
>  int intel_display_driver_suspend(struct drm_i915_private *i915);
>  void intel_display_driver_resume(struct drm_i915_private *i915);
> +void intel_display_driver_shutdown(struct drm_i915_private *i915);
> +void intel_display_driver_shutdown_noirq(struct drm_i915_private *i915);
> +void intel_display_driver_shutdown_nogem(struct drm_i915_private *i915);
>  
>  /* interface for intel_display_reset.c */
>  int __intel_display_driver_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 ae5906885359..38c845ad86e5 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -939,43 +939,22 @@ void i915_driver_shutdown(struct drm_i915_private *i915)
>  {
>  	disable_rpm_wakeref_asserts(&i915->runtime_pm);
>  	intel_runtime_pm_disable(&i915->runtime_pm);
> -	intel_power_domains_disable(i915);
>  
> -	intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true);
> -	if (HAS_DISPLAY(i915)) {
> -		drm_kms_helper_poll_disable(&i915->drm);
> -		intel_display_driver_disable_user_access(i915);
> -
> -		drm_atomic_helper_shutdown(&i915->drm);
> -	}
> -
> -	intel_dp_mst_suspend(i915);
> +	intel_display_driver_shutdown(i915);
>  
>  	intel_irq_suspend(i915);
> -	intel_hpd_cancel_work(i915);
> -
> -	if (HAS_DISPLAY(i915))
> -		intel_display_driver_suspend_access(i915);
>  
> -	intel_encoder_suspend_all(&i915->display);
> -	intel_encoder_shutdown_all(&i915->display);
> -
> -	intel_dmc_suspend(&i915->display);
> +	intel_display_driver_shutdown_noirq(i915);
>  
>  	i915_gem_suspend(i915);
>  
> -	/*
> -	 * The only requirement is to reboot with display DC states disabled,
> -	 * for now leaving all display power wells in the INIT power domain
> -	 * enabled.
> -	 *
> -	 * TODO:
> +	/* TODO:
>  	 * - unify the pci_driver::shutdown sequence here with the
>  	 *   pci_driver.driver.pm.poweroff,poweroff_late sequence.
>  	 * - unify the driver remove and system/runtime suspend sequences with
>  	 *   the above unified shutdown/poweroff sequence.
>  	 */
> -	intel_power_domains_driver_remove(i915);
> +

Should intel_display_driver_shutdown_nogem() be called here?

>  	enable_rpm_wakeref_asserts(&i915->runtime_pm);
>  
>  	intel_runtime_pm_driver_last_release(&i915->runtime_pm);
> -- 
> 2.46.0
> 



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux