[Intel-gfx] [PATCH 7/9] drm/i915: split intel_modeset_init() pre/post gem init

Ville Syrjälä ville.syrjala at linux.intel.com
Tue Feb 4 15:05:28 UTC 2020


On Tue, Feb 04, 2020 at 03:42:26PM +0200, Jani Nikula wrote:
> Turn current intel_modeset_init() to a pre-gem init function, and add a
> new intel_modeset_init() function and move all post-gem modeset init
> there, in the correct layer. Again, apart from possible failure paths,
> no functional changes.
> 
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 26 ++++++++++++++++++--
>  drivers/gpu/drm/i915/display/intel_display.h |  1 +
>  drivers/gpu/drm/i915/i915_drv.c              | 14 ++---------
>  3 files changed, 27 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 2cac6d61dba2..39c12a608103 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -17884,8 +17884,8 @@ int intel_modeset_init_noirq(struct drm_i915_private *i915)
>  	return 0;
>  }
>  
> -/* part #2: call after irq install */
> -int intel_modeset_init(struct drm_i915_private *i915)
> +/* part #2: call after irq install, but before gem init */
> +int intel_modeset_init_nogem(struct drm_i915_private *i915)
>  {
>  	struct drm_device *dev = &i915->drm;
>  	enum pipe pipe;
> @@ -17974,6 +17974,28 @@ int intel_modeset_init(struct drm_i915_private *i915)
>  	return 0;
>  }
>  
> +/* part #3: call after gem init */
> +int intel_modeset_init(struct drm_i915_private *i915)
> +{
> +	int ret;
> +
> +	intel_overlay_setup(i915);
> +
> +	if (!HAS_DISPLAY(i915) || !INTEL_DISPLAY_ENABLED(i915))
> +		return 0;
> +
> +	ret = intel_fbdev_init(&i915->drm);
> +	if (ret)
> +		return ret;
> +
> +	/* Only enable hotplug handling once the fbdev is fully set up. */
> +	intel_hpd_init(i915);
> +
> +	intel_init_ipc(i915);

BTW that init_ipc() looks totally misplaced. Should probably be part of
the regular wm init stuff. But that's not for this patch to fix.

Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

> +
> +	return 0;
> +}
> +
>  void i830_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
>  {
>  	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
> diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h
> index 8f994244ccc7..62ee9b9d212c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.h
> +++ b/drivers/gpu/drm/i915/display/intel_display.h
> @@ -615,6 +615,7 @@ intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
>  /* modesetting */
>  void intel_modeset_init_hw(struct drm_i915_private *i915);
>  int intel_modeset_init_noirq(struct drm_i915_private *i915);
> +int intel_modeset_init_nogem(struct drm_i915_private *i915);
>  int intel_modeset_init(struct drm_i915_private *i915);
>  void intel_modeset_driver_remove(struct drm_i915_private *i915);
>  void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915);
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 905277490024..21f07709dc9e 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -316,7 +316,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);
> +	ret = intel_modeset_init_nogem(i915);
>  	if (ret)
>  		goto out;
>  
> @@ -324,20 +324,10 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915)
>  	if (ret)
>  		goto cleanup_modeset;
>  
> -	intel_overlay_setup(i915);
> -
> -	if (!HAS_DISPLAY(i915) || !INTEL_DISPLAY_ENABLED(i915))
> -		return 0;
> -
> -	ret = intel_fbdev_init(&i915->drm);
> +	ret = intel_modeset_init(i915);
>  	if (ret)
>  		goto cleanup_gem;
>  
> -	/* Only enable hotplug handling once the fbdev is fully set up. */
> -	intel_hpd_init(i915);
> -
> -	intel_init_ipc(i915);
> -
>  	return 0;
>  
>  cleanup_gem:
> -- 
> 2.20.1

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list