[Intel-gfx] [PATCH 26/29] drm/i915/dp_mst: Force modeset CRTC if DSC toggling requires it

Ville Syrjälä ville.syrjala at linux.intel.com
Fri Oct 27 14:20:10 UTC 2023


On Tue, Oct 24, 2023 at 04:09:22AM +0300, Imre Deak wrote:
> Enabling / disabling DSC decompression in the branch device downstream
> of the source may reset the while branch device. To avoid this while the
> streams are still active, force a modeset on all CRTC/ports connected to
> this branch device.
> 
> Signed-off-by: Imre Deak <imre.deak at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c |  4 ++
>  drivers/gpu/drm/i915/display/intel_dp_mst.c  | 72 ++++++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_dp_mst.h  |  2 +
>  3 files changed, 78 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 22f88389035bd..a33e5bbf5165a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -6490,6 +6490,10 @@ int intel_atomic_check(struct drm_device *dev,
>  		if (!new_crtc_state->hw.enable || intel_crtc_needs_modeset(new_crtc_state))
>  			continue;
>  
> +		if (intel_dp_mst_crtc_needs_modeset(state, crtc))
> +			intel_modeset_pipes_in_mask_early(state, "MST topology",
> +							  BIT(crtc->pipe));
> +
>  		if (intel_dp_mst_is_slave_trans(new_crtc_state)) {
>  			enum transcoder master = new_crtc_state->mst_master_transcoder;
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 9f4894c2e7860..d4dcfb2c09b2a 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -1606,3 +1606,75 @@ int intel_dp_mst_add_topology_state_for_crtc(struct intel_atomic_state *state,
>  
>  	return 0;
>  }
> +
> +static struct intel_connector *
> +get_connector_in_state_for_crtc(struct intel_atomic_state *state,
> +				const struct intel_crtc *crtc)
> +{
> +	struct drm_connector_state *old_conn_state;
> +	struct drm_connector_state *new_conn_state;
> +	struct drm_connector *_connector;
> +	int i;
> +
> +	for_each_oldnew_connector_in_state(&state->base, _connector,
> +					   old_conn_state, new_conn_state, i) {
> +		struct intel_connector *connector =
> +			to_intel_connector(_connector);
> +
> +		if (old_conn_state->crtc == &crtc->base ||
> +		    new_conn_state->crtc == &crtc->base)
> +			return connector;
> +	}
> +
> +	return NULL;
> +}
> +
> +bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state,
> +				     struct intel_crtc *crtc)
> +{
> +	const struct intel_connector *crtc_connector;
> +	const struct drm_connector_state *conn_state;
> +	const struct drm_connector *_connector;
> +	int i;
> +
> +	if (!intel_crtc_has_type(intel_atomic_get_new_crtc_state(state, crtc),
> +				 INTEL_OUTPUT_DP_MST))
> +		return false;
> +
> +	crtc_connector = get_connector_in_state_for_crtc(state, crtc);
> +
> +	if (!crtc_connector)
> +		/* None of the connectors in the topology needs modeset */
> +		return false;
> +
> +	for_each_new_connector_in_state(&state->base, _connector, conn_state, i) {
> +		const struct intel_connector *connector =
> +			to_intel_connector(_connector);
> +		const struct intel_crtc_state *new_crtc_state =
> +			intel_atomic_get_new_crtc_state(state, crtc);
> +		const struct intel_crtc_state *old_crtc_state =
> +			intel_atomic_get_old_crtc_state(state, crtc);

What's supposed to be happening here? You're just checking the same
crtc every time through the loop.

> +
> +		if (connector->mst_port != crtc_connector->mst_port)
> +			continue;
> +
> +		if (!intel_crtc_needs_modeset(new_crtc_state))
> +			continue;
> +
> +		if (old_crtc_state->dsc.compression_enable ==
> +		    new_crtc_state->dsc.compression_enable)
> +			continue;
> +
> +		/*
> +		 * Toggling the compression flag because of this stream in the first
> +		 * downstream branch device's UFP DPCD may reset the whole branch
> +		 * device. To avoid the reset while other streams are also
> +		 * active modeset the whole MST topology in this case.
> +		 */
> +		if (connector->dp.dsc_decompression_aux ==
> +		    &connector->mst_port->aux)
> +			return true;
> +	}
> +
> +	return false;
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.h b/drivers/gpu/drm/i915/display/intel_dp_mst.h
> index f1815bb722672..fc5e85776a858 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.h
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.h
> @@ -22,5 +22,7 @@ bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state);
>  bool intel_dp_mst_source_support(struct intel_dp *intel_dp);
>  int intel_dp_mst_add_topology_state_for_crtc(struct intel_atomic_state *state,
>  					     struct intel_crtc *crtc);
> +bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state,
> +				     struct intel_crtc *crtc);
>  
>  #endif /* __INTEL_DP_MST_H__ */
> -- 
> 2.39.2

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list