[Intel-gfx] [PATCH v2 6/6] drm/i915: pass i915 to intel_modeset_init() and intel_modeset_init_hw()

Jani Nikula jani.nikula at intel.com
Fri Sep 20 19:05:23 UTC 2019


On Fri, 20 Sep 2019, Jani Nikula <jani.nikula at intel.com> wrote:
> In general, prefer struct drm_i915_private * over struct drm_device *
> when either will do. Rename the local variables to i915. No functional
> changes.

This one was also already

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

in http://mid.mail-archive.com/156890721641.1196.17548415265398501279@skylake-alporthouse-com

>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 69 ++++++++++----------
>  drivers/gpu/drm/i915/display/intel_display.h |  4 +-
>  drivers/gpu/drm/i915/i915_drv.c              |  4 +-
>  3 files changed, 37 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 9c26228737a0..f9f116c89bcc 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -4360,7 +4360,7 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)
>  		 * so need a full re-initialization.
>  		 */
>  		intel_pps_unlock_regs_wa(dev_priv);
> -		intel_modeset_init_hw(dev);
> +		intel_modeset_init_hw(dev_priv);
>  		intel_init_clock_gating(dev_priv);
>  
>  		spin_lock_irq(&dev_priv->irq_lock);
> @@ -15983,13 +15983,11 @@ static void i915_disable_vga(struct drm_i915_private *dev_priv)
>  	POSTING_READ(vga_reg);
>  }
>  
> -void intel_modeset_init_hw(struct drm_device *dev)
> +void intel_modeset_init_hw(struct drm_i915_private *i915)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(dev);
> -
> -	intel_update_cdclk(dev_priv);
> -	intel_dump_cdclk_state(&dev_priv->cdclk.hw, "Current CDCLK");
> -	dev_priv->cdclk.logical = dev_priv->cdclk.actual = dev_priv->cdclk.hw;
> +	intel_update_cdclk(i915);
> +	intel_dump_cdclk_state(&i915->cdclk.hw, "Current CDCLK");
> +	i915->cdclk.logical = i915->cdclk.actual = i915->cdclk.hw;
>  }
>  
>  /*
> @@ -16195,42 +16193,42 @@ static void intel_mode_config_init(struct drm_i915_private *i915)
>  	}
>  }
>  
> -int intel_modeset_init(struct drm_device *dev)
> +int intel_modeset_init(struct drm_i915_private *i915)
>  {
> -	struct drm_i915_private *dev_priv = to_i915(dev);
> +	struct drm_device *dev = &i915->drm;
>  	enum pipe pipe;
>  	struct intel_crtc *crtc;
>  	int ret;
>  
> -	dev_priv->modeset_wq = alloc_ordered_workqueue("i915_modeset", 0);
> -	dev_priv->flip_wq = alloc_workqueue("i915_flip", WQ_HIGHPRI |
> -					    WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
> +	i915->modeset_wq = alloc_ordered_workqueue("i915_modeset", 0);
> +	i915->flip_wq = alloc_workqueue("i915_flip", WQ_HIGHPRI |
> +					WQ_UNBOUND, WQ_UNBOUND_MAX_ACTIVE);
>  
> -	intel_mode_config_init(dev_priv);
> +	intel_mode_config_init(i915);
>  
> -	ret = intel_bw_init(dev_priv);
> +	ret = intel_bw_init(i915);
>  	if (ret)
>  		return ret;
>  
> -	init_llist_head(&dev_priv->atomic_helper.free_list);
> -	INIT_WORK(&dev_priv->atomic_helper.free_work,
> +	init_llist_head(&i915->atomic_helper.free_list);
> +	INIT_WORK(&i915->atomic_helper.free_work,
>  		  intel_atomic_helper_free_state_worker);
>  
> -	intel_init_quirks(dev_priv);
> +	intel_init_quirks(i915);
>  
> -	intel_fbc_init(dev_priv);
> +	intel_fbc_init(i915);
>  
> -	intel_init_pm(dev_priv);
> +	intel_init_pm(i915);
>  
> -	intel_panel_sanitize_ssc(dev_priv);
> +	intel_panel_sanitize_ssc(i915);
>  
>  	DRM_DEBUG_KMS("%d display pipe%s available.\n",
> -		      INTEL_NUM_PIPES(dev_priv),
> -		      INTEL_NUM_PIPES(dev_priv) > 1 ? "s" : "");
> +		      INTEL_NUM_PIPES(i915),
> +		      INTEL_NUM_PIPES(i915) > 1 ? "s" : "");
>  
> -	if (HAS_DISPLAY(dev_priv) && INTEL_DISPLAY_ENABLED(dev_priv)) {
> -		for_each_pipe(dev_priv, pipe) {
> -			ret = intel_crtc_init(dev_priv, pipe);
> +	if (HAS_DISPLAY(i915) && INTEL_DISPLAY_ENABLED(i915)) {
> +		for_each_pipe(i915, pipe) {
> +			ret = intel_crtc_init(i915, pipe);
>  			if (ret) {
>  				drm_mode_config_cleanup(dev);
>  				return ret;
> @@ -16239,19 +16237,19 @@ int intel_modeset_init(struct drm_device *dev)
>  	}
>  
>  	intel_shared_dpll_init(dev);
> -	intel_update_fdi_pll_freq(dev_priv);
> +	intel_update_fdi_pll_freq(i915);
>  
> -	intel_update_czclk(dev_priv);
> -	intel_modeset_init_hw(dev);
> +	intel_update_czclk(i915);
> +	intel_modeset_init_hw(i915);
>  
> -	intel_hdcp_component_init(dev_priv);
> +	intel_hdcp_component_init(i915);
>  
> -	if (dev_priv->max_cdclk_freq == 0)
> -		intel_update_max_cdclk(dev_priv);
> +	if (i915->max_cdclk_freq == 0)
> +		intel_update_max_cdclk(i915);
>  
>  	/* Just disable it once at startup */
> -	i915_disable_vga(dev_priv);
> -	intel_setup_outputs(dev_priv);
> +	i915_disable_vga(i915);
> +	intel_setup_outputs(i915);
>  
>  	drm_modeset_lock_all(dev);
>  	intel_modeset_setup_hw_state(dev, dev->mode_config.acquire_ctx);
> @@ -16270,8 +16268,7 @@ int intel_modeset_init(struct drm_device *dev)
>  		 * can even allow for smooth boot transitions if the BIOS
>  		 * fb is large enough for the active pipe configuration.
>  		 */
> -		dev_priv->display.get_initial_plane_config(crtc,
> -							   &plane_config);
> +		i915->display.get_initial_plane_config(crtc, &plane_config);
>  
>  		/*
>  		 * If the fb is shared between multiple heads, we'll
> @@ -16285,7 +16282,7 @@ int intel_modeset_init(struct drm_device *dev)
>  	 * Note that we need to do this after reconstructing the BIOS fb's
>  	 * since the watermark calculation done here will use pstate->fb.
>  	 */
> -	if (!HAS_GMCH(dev_priv))
> +	if (!HAS_GMCH(i915))
>  		sanitize_watermarks(dev);
>  
>  	/*
> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
> index 933cbe36bb59..5cea6f8e107a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.h
> +++ b/drivers/gpu/drm/i915/display/intel_display.h
> @@ -576,8 +576,8 @@ void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
>  				     struct intel_display_error_state *error);
>  
>  /* modesetting */
> -void intel_modeset_init_hw(struct drm_device *dev);
> -int intel_modeset_init(struct drm_device *dev);
> +void intel_modeset_init_hw(struct drm_i915_private *i915);
> +int intel_modeset_init(struct drm_i915_private *i915);
>  void intel_modeset_driver_remove(struct drm_i915_private *i915);
>  int intel_modeset_vga_set_state(struct drm_i915_private *dev_priv, bool state);
>  void intel_display_resume(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index d9b9e9644f5c..a9ee73b61f4d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -378,7 +378,7 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915)
>  
>  	/* Important: The output setup functions called by modeset_init need
>  	 * working irqs for e.g. gmbus and dp aux transfers. */
> -	ret = intel_modeset_init(&i915->drm);
> +	ret = intel_modeset_init(i915);
>  	if (ret)
>  		goto cleanup_irq;
>  
> @@ -1909,7 +1909,7 @@ static int i915_drm_resume(struct drm_device *dev)
>  
>  	i915_gem_resume(dev_priv);
>  
> -	intel_modeset_init_hw(dev);
> +	intel_modeset_init_hw(dev_priv);
>  	intel_init_clock_gating(dev_priv);
>  
>  	spin_lock_irq(&dev_priv->irq_lock);

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list