[Intel-gfx] [Intel-xe] [PATCH 1/5] drm/i915: Split display locks init from i915_driver_early_probe()

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Apr 3 17:03:27 UTC 2023


On Mon, Apr 03, 2023 at 09:46:11AM -0700, José Roberto de Souza wrote:
> No behavior changes here, just adding a function to make clear
> what locks initialized here are display related or not.
> 
> Cc: intel-gfx at lists.freedesktop.org
> Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_driver.c | 23 +++++++++++++++--------
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 066d79c2069c4..224cb4cb43335 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -188,6 +188,20 @@ static void sanitize_gpu(struct drm_i915_private *i915)
>  	}
>  }
>  
> +static void
> +i915_driver_display_early_probe(struct drm_i915_private *dev_priv)
> +{
> +	spin_lock_init(&dev_priv->display.fb_tracking.lock);
> +	spin_lock_init(&dev_priv->display.wm.dsparb_lock);
> +	mutex_init(&dev_priv->display.backlight.lock);
> +
> +	mutex_init(&dev_priv->display.audio.mutex);
> +	mutex_init(&dev_priv->display.wm.wm_mutex);
> +	mutex_init(&dev_priv->display.pps.mutex);
> +	mutex_init(&dev_priv->display.hdcp.comp_mutex);
> +	spin_lock_init(&dev_priv->display.dkl.phy_lock);
> +}
> +

hmmm... I like that, however Jani had indicated in another series [1]
that he would prefer the wm mutex inside the wm code for instance...

So, should we move all of these to their own components instead of this
move?

[1] https://patchwork.freedesktop.org/series/115675/

I checked and for a few components it is simple to move them to their
own init functions. However for a few we would need to create new init
functions and call them here.

Jani, more thoughts?

>  /**
>   * i915_driver_early_probe - setup state not requiring device access
>   * @dev_priv: device private
> @@ -213,18 +227,11 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
>  
>  	spin_lock_init(&dev_priv->irq_lock);
>  	spin_lock_init(&dev_priv->gpu_error.lock);
> -	spin_lock_init(&dev_priv->display.fb_tracking.lock);
> -	spin_lock_init(&dev_priv->display.wm.dsparb_lock);
> -	mutex_init(&dev_priv->display.backlight.lock);
>  
>  	mutex_init(&dev_priv->sb_lock);
>  	cpu_latency_qos_add_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE);
>  
> -	mutex_init(&dev_priv->display.audio.mutex);
> -	mutex_init(&dev_priv->display.wm.wm_mutex);
> -	mutex_init(&dev_priv->display.pps.mutex);
> -	mutex_init(&dev_priv->display.hdcp.comp_mutex);
> -	spin_lock_init(&dev_priv->display.dkl.phy_lock);
> +	i915_driver_display_early_probe(dev_priv);
>  
>  	i915_memcpy_init_early(dev_priv);
>  	intel_runtime_pm_init_early(&dev_priv->runtime_pm);
> -- 
> 2.40.0
> 


More information about the Intel-gfx mailing list