[Intel-gfx] [PATCH v2 6/6] drm/i915: Use intel_ddi_get_config() for MST

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Mon Oct 30 09:00:04 UTC 2017


Op 27-10-17 om 21:31 schreef Ville Syrjala:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Eliminate the partially duplicated DDI readout code from MST, and
> instead just call intel_ddi_get_config(). As a nice bonus we get
> more cross checking as intel_ddi_get_config() will populate
> output_types based on the actual mode of the DDI port.
>
> Additonally intel_ddi_get_config() must be changed to get the crtc
> from the passed in crtc state rather than from the encoder->crtc link.
> encoder->crtc really shouldn't be used anyway.
>
> v2: Rebased on BXT MST latency_optim fix
>     Make intel_ddi_clock_get() static
>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c    |  6 ++---
>  drivers/gpu/drm/i915/intel_dp_mst.c | 50 +------------------------------------
>  drivers/gpu/drm/i915/intel_drv.h    |  2 --
>  3 files changed, 4 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 0f603a157dba..cc3d55b5cea0 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1453,8 +1453,8 @@ static void bxt_ddi_clock_get(struct intel_encoder *encoder,
>  	ddi_dotclock_get(pipe_config);
>  }
>  
> -void intel_ddi_clock_get(struct intel_encoder *encoder,
> -			 struct intel_crtc_state *pipe_config)
> +static void intel_ddi_clock_get(struct intel_encoder *encoder,
> +				struct intel_crtc_state *pipe_config)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  
> @@ -2533,7 +2533,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
>  			  struct intel_crtc_state *pipe_config)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> -	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> +	struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc);
>  	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
>  	struct intel_digital_port *intel_dig_port;
>  	u32 temp, flags = 0;
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index d523302e5081..6f11bb35f66f 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -286,56 +286,8 @@ static void intel_dp_mst_enc_get_config(struct intel_encoder *encoder,
>  {
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
>  	struct intel_digital_port *intel_dig_port = intel_mst->primary;
> -	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
> -	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> -	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
> -	u32 temp, flags = 0;
>  
> -	pipe_config->output_types |= BIT(INTEL_OUTPUT_DP_MST);
> -
> -	pipe_config->has_audio =
> -		intel_ddi_is_audio_enabled(dev_priv, crtc);
> -
> -	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
> -	if (temp & TRANS_DDI_PHSYNC)
> -		flags |= DRM_MODE_FLAG_PHSYNC;
> -	else
> -		flags |= DRM_MODE_FLAG_NHSYNC;
> -	if (temp & TRANS_DDI_PVSYNC)
> -		flags |= DRM_MODE_FLAG_PVSYNC;
> -	else
> -		flags |= DRM_MODE_FLAG_NVSYNC;
> -
> -	switch (temp & TRANS_DDI_BPC_MASK) {
> -	case TRANS_DDI_BPC_6:
> -		pipe_config->pipe_bpp = 18;
> -		break;
> -	case TRANS_DDI_BPC_8:
> -		pipe_config->pipe_bpp = 24;
> -		break;
> -	case TRANS_DDI_BPC_10:
> -		pipe_config->pipe_bpp = 30;
> -		break;
> -	case TRANS_DDI_BPC_12:
> -		pipe_config->pipe_bpp = 36;
> -		break;
> -	default:
> -		break;
> -	}
> -	pipe_config->base.adjusted_mode.flags |= flags;
> -
> -	pipe_config->lane_count =
> -		((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
> -
> -	intel_dp_get_m_n(crtc, pipe_config);
> -
> -	intel_ddi_clock_get(&intel_dig_port->base, pipe_config);
> -
> -	if (IS_GEN9_LP(dev_priv))
> -		pipe_config->lane_lat_optim_mask =
> -			bxt_ddi_phy_get_lane_lat_optim_mask(encoder);
> -
> -	intel_ddi_compute_min_voltage_level(dev_priv, pipe_config);
> +	intel_ddi_get_config(&intel_dig_port->base, pipe_config);
>  }
>  
>  static int intel_dp_mst_get_ddc_modes(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 3828d9bee7f5..4498d743cebc 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1295,8 +1295,6 @@ bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
>  void intel_ddi_get_config(struct intel_encoder *encoder,
>  			  struct intel_crtc_state *pipe_config);
>  
> -void intel_ddi_clock_get(struct intel_encoder *encoder,
> -			 struct intel_crtc_state *pipe_config);
>  void intel_ddi_set_vc_payload_alloc(const struct intel_crtc_state *crtc_state,
>  				    bool state);
>  void intel_ddi_compute_min_voltage_level(struct drm_i915_private *dev_priv,

I still don't like patch 5/6, but lets just see if it breaks too often in the future, if so we could always revert.. for the whole series:

Reviewed-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>



More information about the Intel-gfx mailing list