Re: [PATCH v4 2/8] drm/i915/display: Move the commit_tail() disable sequence to commit_modeset_disables() hook

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

 



Lucas/Maarten/Daniel, could you please review this so this can be upstreamed
and I can base my tran port sync series on top without carrying this over?

This is a cleanup patch with no functional change and addresses the review
commen from Daniel.

Manasi

On Thu, Jun 27, 2019 at 03:57:36PM -0700, Manasi Navare wrote:
> Create a new hook commit_modeset_disables() consistent with the naming
> in drm atomic helpers and similar to the commit_modeset_enables() hook.
> This helps better organize the disable sequence in atomic_commit_tail()
> and move that to this disable hook.
> 
> No functional change
> 
> v2:
> * Create a helper for old_crtc_state disables (Lucas)
> 
> Suggested-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Cc: Matt Roper <matthew.d.roper@xxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Signed-off-by: Manasi Navare <manasi.d.navare@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 116 ++++++++++++-------
>  drivers/gpu/drm/i915/i915_drv.h              |   1 +
>  2 files changed, 75 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 71e86e2f0f90..4b088fa24aad 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -13613,6 +13613,69 @@ static void intel_update_crtc(struct drm_crtc *crtc,
>  	intel_finish_crtc_commit(to_intel_atomic_state(state), intel_crtc);
>  }
>  
> +static void intel_old_crtc_state_disables(struct drm_atomic_state *state,
> +					  struct intel_crtc_state *old_intel_crtc_state,
> +					  struct intel_crtc_state *new_intel_crtc_state,
> +					  struct intel_crtc *intel_crtc)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(state->dev);
> +	struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
> +	struct drm_crtc_state *new_crtc_state = &new_intel_crtc_state->base;
> +
> +	intel_crtc_disable_planes(intel_state, intel_crtc);
> +
> +	/*
> +	 * We need to disable pipe CRC before disabling the pipe,
> +	 * or we race against vblank off.
> +	 */
> +	intel_crtc_disable_pipe_crc(intel_crtc);
> +
> +	dev_priv->display.crtc_disable(old_intel_crtc_state, state);
> +	intel_crtc->active = false;
> +	intel_fbc_disable(intel_crtc);
> +	intel_disable_shared_dpll(old_intel_crtc_state);
> +
> +	/*
> +	 * Underruns don't always raise interrupts,
> +	 * so check manually.
> +	 */
> +	intel_check_cpu_fifo_underruns(dev_priv);
> +	intel_check_pch_fifo_underruns(dev_priv);
> +
> +	/* FIXME unify this for all platforms */
> +	if (!new_crtc_state->active &&
> +	    !HAS_GMCH(dev_priv) &&
> +	    dev_priv->display.initial_watermarks)
> +		dev_priv->display.initial_watermarks(intel_state,
> +						     new_intel_crtc_state);
> +}
> +
> +static void intel_commit_modeset_disables(struct drm_atomic_state *state)
> +{
> +	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> +	struct intel_crtc_state *new_intel_crtc_state, *old_intel_crtc_state;
> +	struct drm_crtc *crtc;
> +	struct intel_crtc *intel_crtc;
> +	int i;
> +
> +	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
> +		old_intel_crtc_state = to_intel_crtc_state(old_crtc_state);
> +		new_intel_crtc_state = to_intel_crtc_state(new_crtc_state);
> +		intel_crtc = to_intel_crtc(crtc);
> +
> +		if (!needs_modeset(new_crtc_state))
> +			continue;
> +
> +		intel_pre_plane_update(old_intel_crtc_state, new_intel_crtc_state);
> +
> +		if (old_crtc_state->active)
> +			intel_old_crtc_state_disables(state,
> +						      old_intel_crtc_state,
> +						      new_intel_crtc_state,
> +						      intel_crtc);
> +	}
> +}
> +
>  static void intel_commit_modeset_enables(struct drm_atomic_state *state)
>  {
>  	struct drm_crtc *crtc;
> @@ -13769,7 +13832,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
>  	struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
> -	struct intel_crtc_state *new_intel_crtc_state, *old_intel_crtc_state;
> +	struct intel_crtc_state *new_intel_crtc_state;
>  	struct drm_crtc *crtc;
>  	struct intel_crtc *intel_crtc;
>  	u64 put_domains[I915_MAX_PIPES] = {};
> @@ -13778,58 +13841,24 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
>  
>  	intel_atomic_commit_fence_wait(intel_state);
>  
> -	drm_atomic_helper_wait_for_dependencies(state);
> -
> -	if (intel_state->modeset)
> -		wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET);
> -
>  	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
> -		old_intel_crtc_state = to_intel_crtc_state(old_crtc_state);
>  		new_intel_crtc_state = to_intel_crtc_state(new_crtc_state);
>  		intel_crtc = to_intel_crtc(crtc);
>  
>  		if (needs_modeset(new_crtc_state) ||
> -		    to_intel_crtc_state(new_crtc_state)->update_pipe) {
> -
> +		    new_intel_crtc_state->update_pipe) {
>  			put_domains[intel_crtc->pipe] =
>  				modeset_get_crtc_power_domains(crtc,
> -					new_intel_crtc_state);
> +							       new_intel_crtc_state);
>  		}
> +	}
>  
> -		if (!needs_modeset(new_crtc_state))
> -			continue;
> -
> -		intel_pre_plane_update(old_intel_crtc_state, new_intel_crtc_state);
> -
> -		if (old_crtc_state->active) {
> -			intel_crtc_disable_planes(intel_state, intel_crtc);
> -
> -			/*
> -			 * We need to disable pipe CRC before disabling the pipe,
> -			 * or we race against vblank off.
> -			 */
> -			intel_crtc_disable_pipe_crc(intel_crtc);
> +	drm_atomic_helper_wait_for_dependencies(state);
>  
> -			dev_priv->display.crtc_disable(old_intel_crtc_state, state);
> -			intel_crtc->active = false;
> -			intel_fbc_disable(intel_crtc);
> -			intel_disable_shared_dpll(old_intel_crtc_state);
> +	if (intel_state->modeset)
> +		wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET);
>  
> -			/*
> -			 * Underruns don't always raise
> -			 * interrupts, so check manually.
> -			 */
> -			intel_check_cpu_fifo_underruns(dev_priv);
> -			intel_check_pch_fifo_underruns(dev_priv);
> -
> -			/* FIXME unify this for all platforms */
> -			if (!new_crtc_state->active &&
> -			    !HAS_GMCH(dev_priv) &&
> -			    dev_priv->display.initial_watermarks)
> -				dev_priv->display.initial_watermarks(intel_state,
> -								     new_intel_crtc_state);
> -		}
> -	}
> +	dev_priv->display.commit_modeset_disables(state);
>  
>  	/* FIXME: Eventually get rid of our intel_crtc->config pointer */
>  	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
> @@ -15722,6 +15751,9 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
>  		dev_priv->display.commit_modeset_enables = skl_commit_modeset_enables;
>  	else
>  		dev_priv->display.commit_modeset_enables = intel_commit_modeset_enables;
> +
> +	dev_priv->display.commit_modeset_disables = intel_commit_modeset_disables;
> +
>  }
>  
>  static i915_reg_t i915_vgacntrl_reg(struct drm_i915_private *dev_priv)
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 075d7eb3c3f2..edb6b431f90c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -311,6 +311,7 @@ struct drm_i915_display_funcs {
>  	void (*crtc_disable)(struct intel_crtc_state *old_crtc_state,
>  			     struct drm_atomic_state *old_state);
>  	void (*commit_modeset_enables)(struct drm_atomic_state *state);
> +	void (*commit_modeset_disables)(struct drm_atomic_state *state);
>  	void (*audio_codec_enable)(struct intel_encoder *encoder,
>  				   const struct intel_crtc_state *crtc_state,
>  				   const struct drm_connector_state *conn_state);
> -- 
> 2.19.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




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

  Powered by Linux