[Intel-gfx] [PATCH 05/15] drm/i915: Pass crtc_state and connector_state to encoder functions

Daniel Vetter daniel at ffwll.ch
Thu Aug 18 13:30:16 UTC 2016


On Tue, Aug 09, 2016 at 05:04:04PM +0200, Maarten Lankhorst wrote:
> This is mostly code churn, with exception of a few places:
> - intel_display.c has changes in intel_sanitize_encoder
> - intel_ddi.c has intel_ddi_fdi_disable calling intel_ddi_post_disable,
>   and required a function change. Also affects intel_display.c
> - intel_dp_mst.c passes a NULL crtc_state and conn_state to
>   intel_ddi_post_disable for shutting down the real encoder.

I didn't find this NULL callsite. Outdated commit message?

> 
> No other functional changes are done, diff stat is already huge.
> Each encoder type will need to be fixed to use the atomic states
> separately.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> @@ -5131,12 +5137,26 @@ static void haswell_crtc_disable(struct intel_crtc_state *old_crtc_state,
>  	if (!transcoder_is_dsi(cpu_transcoder))
>  		intel_ddi_disable_pipe_clock(intel_crtc);
>  
> -	intel_encoders_post_disable(crtc, old_state);
> +	intel_encoders_post_disable(crtc, old_crtc_state, old_state);
>  
>  	if (intel_crtc->config->has_pch_encoder) {
> +		struct drm_connector_state *old_conn_state;
> +		struct drm_connector *conn;
> +		int i;
> +
>  		lpt_disable_pch_transcoder(dev_priv);
>  		lpt_disable_iclkip(dev_priv);
> -		intel_ddi_fdi_disable(crtc);
> +
> +		for_each_connector_in_state(old_state, conn, old_conn_state, i)
> +			if (old_conn_state->crtc == crtc) {
> +				struct intel_encoder *encoder =
> +					to_intel_encoder(old_conn_state->best_encoder);
> +
> +				intel_ddi_fdi_disable(encoder,
> +						      old_crtc_state,
> +						      old_conn_state);
> +				break;
> +			}

This is pretty much the reasone why I think the hsw+ fdi code should be
part of the lpt+crt encoder driver, and _not_ in the shared crtc logic.
I've sent around patches a few times to make this happen, but they all got
shot down because that makes it unlike the ilk-ivb modeset code.

Imo it's time to finally do this, at least for this one here. Needs to be
a prep patch.

>  
>  		intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A,
>  						      true);
> @@ -6227,7 +6247,7 @@ static void valleyview_crtc_enable(struct intel_crtc_state *pipe_config,
>  
>  	intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
>  
> -	intel_encoders_pre_pll_enable(crtc, old_state);
> +	intel_encoders_pre_pll_enable(crtc, pipe_config, old_state);
>  
>  	if (IS_CHERRYVIEW(dev)) {
>  		chv_prepare_pll(intel_crtc, intel_crtc->config);
> @@ -6237,7 +6257,7 @@ static void valleyview_crtc_enable(struct intel_crtc_state *pipe_config,
>  		vlv_enable_pll(intel_crtc, intel_crtc->config);
>  	}
>  
> -	intel_encoders_pre_enable(crtc, old_state);
> +	intel_encoders_pre_enable(crtc, pipe_config, old_state);
>  
>  	i9xx_pfit_enable(intel_crtc);
>  
> @@ -6249,7 +6269,7 @@ static void valleyview_crtc_enable(struct intel_crtc_state *pipe_config,
>  	assert_vblank_disabled(crtc);
>  	drm_crtc_vblank_on(crtc);
>  
> -	intel_encoders_enable(crtc, old_state);
> +	intel_encoders_enable(crtc, pipe_config, old_state);
>  }
>  
>  static void i9xx_set_pll_dividers(struct intel_crtc *crtc)
> @@ -6288,7 +6308,7 @@ static void i9xx_crtc_enable(struct intel_crtc_state *pipe_config,
>  	if (!IS_GEN2(dev))
>  		intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
>  
> -	intel_encoders_pre_enable(crtc, old_state);
> +	intel_encoders_pre_enable(crtc, pipe_config, old_state);
>  
>  	i9xx_enable_pll(intel_crtc);
>  
> @@ -6302,7 +6322,7 @@ static void i9xx_crtc_enable(struct intel_crtc_state *pipe_config,
>  	assert_vblank_disabled(crtc);
>  	drm_crtc_vblank_on(crtc);
>  
> -	intel_encoders_enable(crtc, old_state);
> +	intel_encoders_enable(crtc, pipe_config, old_state);
>  }
>  
>  static void i9xx_pfit_disable(struct intel_crtc *crtc)
> @@ -6336,7 +6356,7 @@ static void i9xx_crtc_disable(struct intel_crtc_state *old_crtc_state,
>  	if (IS_GEN2(dev))
>  		intel_wait_for_vblank(dev, pipe);
>  
> -	intel_encoders_disable(crtc, old_state);
> +	intel_encoders_disable(crtc, old_crtc_state, old_state);
>  
>  	drm_crtc_vblank_off(crtc);
>  	assert_vblank_disabled(crtc);
> @@ -6345,7 +6365,7 @@ static void i9xx_crtc_disable(struct intel_crtc_state *old_crtc_state,
>  
>  	i9xx_pfit_disable(intel_crtc);
>  
> -	intel_encoders_post_disable(crtc, old_state);
> +	intel_encoders_post_disable(crtc, old_crtc_state, old_state);
>  
>  	if (!intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_DSI)) {
>  		if (IS_CHERRYVIEW(dev))
> @@ -6356,7 +6376,7 @@ static void i9xx_crtc_disable(struct intel_crtc_state *old_crtc_state,
>  			i9xx_disable_pll(intel_crtc);
>  	}
>  
> -	intel_encoders_post_pll_disable(crtc, old_state);
> +	intel_encoders_post_pll_disable(crtc, old_crtc_state, old_state);
>  
>  	if (!IS_GEN2(dev))
>  		intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
> @@ -15858,17 +15878,6 @@ static bool intel_crtc_has_encoders(struct intel_crtc *crtc)
>  	return false;
>  }
>  
> -static bool intel_encoder_has_connectors(struct intel_encoder *encoder)
> -{
> -	struct drm_device *dev = encoder->base.dev;
> -	struct intel_connector *connector;
> -
> -	for_each_connector_on_encoder(dev, &encoder->base, connector)
> -		return true;
> -
> -	return false;
> -}

Imo rename this to static intel_connector *intel_encoder_find_connector
and then the below code changes becomes a lot more readable.

Otherwise lgtm.
-Daniel

> -
>  static void intel_sanitize_crtc(struct intel_crtc *crtc)
>  {
>  	struct drm_device *dev = crtc->base.dev;
> @@ -15955,6 +15964,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  {
>  	struct intel_connector *connector;
>  	struct drm_device *dev = encoder->base.dev;
> +	bool found_connector = false;
>  
>  	/* We need to check both for a crtc link (meaning that the
>  	 * encoder is active and trying to read from a pipe) and the
> @@ -15962,7 +15972,12 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  	bool has_active_crtc = encoder->base.crtc &&
>  		to_intel_crtc(encoder->base.crtc)->active;
>  
> -	if (intel_encoder_has_connectors(encoder) && !has_active_crtc) {
> +	for_each_connector_on_encoder(dev, &encoder->base, connector) {
> +		found_connector = true;
> +		break;
> +	}
> +
> +	if (found_connector && !has_active_crtc) {
>  		DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no active pipe!\n",
>  			      encoder->base.base.id,
>  			      encoder->base.name);
> @@ -15971,12 +15986,14 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  		 * fallout from our resume register restoring. Disable
>  		 * the encoder manually again. */
>  		if (encoder->base.crtc) {
> +			struct drm_crtc_state *crtc_state = encoder->base.crtc->state;
> +
>  			DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n",
>  				      encoder->base.base.id,
>  				      encoder->base.name);
> -			encoder->disable(encoder);
> +			encoder->disable(encoder, to_intel_crtc_state(crtc_state), connector->base.state);
>  			if (encoder->post_disable)
> -				encoder->post_disable(encoder);
> +				encoder->post_disable(encoder, to_intel_crtc_state(crtc_state), connector->base.state);
>  		}
>  		encoder->base.crtc = NULL;
>  
> @@ -15984,12 +16001,9 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
>  		 * a bug in one of the get_hw_state functions. Or someplace else
>  		 * in our code, like the register restore mess on resume. Clamp
>  		 * things to off as a safer default. */
> -		for_each_intel_connector(dev, connector) {
> -			if (connector->encoder != encoder)
> -				continue;
> -			connector->base.dpms = DRM_MODE_DPMS_OFF;
> -			connector->base.encoder = NULL;
> -		}
> +
> +		connector->base.dpms = DRM_MODE_DPMS_OFF;
> +		connector->base.encoder = NULL;
>  	}
>  	/* Enabled encoders without active connectors will be fixed in
>  	 * the crtc fixup. */
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 8fe2afa5439e..8bf1ba3166e9 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2479,7 +2479,9 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
>  	}
>  }
>  
> -static void intel_disable_dp(struct intel_encoder *encoder)
> +static void intel_disable_dp(struct intel_encoder *encoder,
> +			     struct intel_crtc_state *old_crtc_state,
> +			     struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	struct drm_device *dev = encoder->base.dev;
> @@ -2503,7 +2505,9 @@ static void intel_disable_dp(struct intel_encoder *encoder)
>  		intel_dp_link_down(intel_dp);
>  }
>  
> -static void ilk_post_disable_dp(struct intel_encoder *encoder)
> +static void ilk_post_disable_dp(struct intel_encoder *encoder,
> +				struct intel_crtc_state *old_crtc_state,
> +				struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	enum port port = dp_to_dig_port(intel_dp)->port;
> @@ -2515,14 +2519,18 @@ static void ilk_post_disable_dp(struct intel_encoder *encoder)
>  		ironlake_edp_pll_off(intel_dp);
>  }
>  
> -static void vlv_post_disable_dp(struct intel_encoder *encoder)
> +static void vlv_post_disable_dp(struct intel_encoder *encoder,
> +				struct intel_crtc_state *old_crtc_state,
> +				struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  
>  	intel_dp_link_down(intel_dp);
>  }
>  
> -static void chv_post_disable_dp(struct intel_encoder *encoder)
> +static void chv_post_disable_dp(struct intel_encoder *encoder,
> +				struct intel_crtc_state *old_crtc_state,
> +				struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	struct drm_device *dev = encoder->base.dev;
> @@ -2696,7 +2704,9 @@ static void intel_enable_dp(struct intel_encoder *encoder)
>  	}
>  }
>  
> -static void g4x_enable_dp(struct intel_encoder *encoder)
> +static void g4x_enable_dp(struct intel_encoder *encoder,
> +			  struct intel_crtc_state *pipe_config,
> +			  struct drm_connector_state *conn_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  
> @@ -2704,7 +2714,9 @@ static void g4x_enable_dp(struct intel_encoder *encoder)
>  	intel_edp_backlight_on(intel_dp);
>  }
>  
> -static void vlv_enable_dp(struct intel_encoder *encoder)
> +static void vlv_enable_dp(struct intel_encoder *encoder,
> +			  struct intel_crtc_state *pipe_config,
> +			  struct drm_connector_state *conn_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  
> @@ -2712,7 +2724,9 @@ static void vlv_enable_dp(struct intel_encoder *encoder)
>  	intel_psr_enable(intel_dp);
>  }
>  
> -static void g4x_pre_enable_dp(struct intel_encoder *encoder)
> +static void g4x_pre_enable_dp(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>  	enum port port = dp_to_dig_port(intel_dp)->port;
> @@ -2827,21 +2841,27 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp)
>  	intel_dp_init_panel_power_sequencer_registers(dev, intel_dp);
>  }
>  
> -static void vlv_pre_enable_dp(struct intel_encoder *encoder)
> +static void vlv_pre_enable_dp(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	vlv_phy_pre_encoder_enable(encoder);
>  
>  	intel_enable_dp(encoder);
>  }
>  
> -static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder)
> +static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	intel_dp_prepare(encoder);
>  
>  	vlv_phy_pre_pll_enable(encoder);
>  }
>  
> -static void chv_pre_enable_dp(struct intel_encoder *encoder)
> +static void chv_pre_enable_dp(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	chv_phy_pre_encoder_enable(encoder);
>  
> @@ -2851,14 +2871,18 @@ static void chv_pre_enable_dp(struct intel_encoder *encoder)
>  	chv_phy_release_cl2_override(encoder);
>  }
>  
> -static void chv_dp_pre_pll_enable(struct intel_encoder *encoder)
> +static void chv_dp_pre_pll_enable(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	intel_dp_prepare(encoder);
>  
>  	chv_phy_pre_pll_enable(encoder);
>  }
>  
> -static void chv_dp_post_pll_disable(struct intel_encoder *encoder)
> +static void chv_dp_post_pll_disable(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	chv_phy_post_pll_disable(encoder);
>  }
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 629337dbca3d..3ec290caef17 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -92,7 +92,9 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  
>  }
>  
> -static void intel_mst_disable_dp(struct intel_encoder *encoder)
> +static void intel_mst_disable_dp(struct intel_encoder *encoder,
> +				 struct intel_crtc_state *old_crtc_state,
> +				 struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
>  	struct intel_digital_port *intel_dig_port = intel_mst->primary;
> @@ -109,7 +111,9 @@ static void intel_mst_disable_dp(struct intel_encoder *encoder)
>  	}
>  }
>  
> -static void intel_mst_post_disable_dp(struct intel_encoder *encoder)
> +static void intel_mst_post_disable_dp(struct intel_encoder *encoder,
> +				      struct intel_crtc_state *old_crtc_state,
> +				      struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
>  	struct intel_digital_port *intel_dig_port = intel_mst->primary;
> @@ -128,12 +132,16 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder)
>  
>  	intel_mst->connector = NULL;
>  	if (intel_dp->active_mst_links == 0) {
> -		intel_dig_port->base.post_disable(&intel_dig_port->base);
> +		intel_dig_port->base.post_disable(&intel_dig_port->base,
> +						  old_crtc_state, NULL);
> +
>  		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
>  	}
>  }
>  
> -static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
> +static void intel_mst_pre_enable_dp(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
>  	struct intel_digital_port *intel_dig_port = intel_mst->primary;
> @@ -200,7 +208,9 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
>  	ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr);
>  }
>  
> -static void intel_mst_enable_dp(struct intel_encoder *encoder)
> +static void intel_mst_enable_dp(struct intel_encoder *encoder,
> +				struct intel_crtc_state *pipe_config,
> +				struct drm_connector_state *conn_state)
>  {
>  	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
>  	struct intel_digital_port *intel_dig_port = intel_mst->primary;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 0e53cc1fd5cc..8e0ca11c0e99 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -195,12 +195,24 @@ struct intel_encoder {
>  	void (*hot_plug)(struct intel_encoder *);
>  	bool (*compute_config)(struct intel_encoder *,
>  			       struct intel_crtc_state *);
> -	void (*pre_pll_enable)(struct intel_encoder *);
> -	void (*pre_enable)(struct intel_encoder *);
> -	void (*enable)(struct intel_encoder *);
> -	void (*disable)(struct intel_encoder *);
> -	void (*post_disable)(struct intel_encoder *);
> -	void (*post_pll_disable)(struct intel_encoder *);
> +	void (*pre_pll_enable)(struct intel_encoder *,
> +			       struct intel_crtc_state *,
> +			       struct drm_connector_state *);
> +	void (*pre_enable)(struct intel_encoder *,
> +			   struct intel_crtc_state *,
> +			   struct drm_connector_state *);
> +	void (*enable)(struct intel_encoder *,
> +		       struct intel_crtc_state *,
> +		       struct drm_connector_state *);
> +	void (*disable)(struct intel_encoder *,
> +			struct intel_crtc_state *,
> +			struct drm_connector_state *);
> +	void (*post_disable)(struct intel_encoder *,
> +			     struct intel_crtc_state *,
> +			     struct drm_connector_state *);
> +	void (*post_pll_disable)(struct intel_encoder *,
> +				 struct intel_crtc_state *,
> +				 struct drm_connector_state *);
>  	/* Read out the current hw state of this connector, returning true if
>  	 * the encoder is active. If the encoder is enabled it also set the pipe
>  	 * it is connected to in the pipe parameter. */
> @@ -1122,7 +1134,9 @@ bool intel_ddi_pll_select(struct intel_crtc *crtc,
>  void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
>  void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
>  bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
> -void intel_ddi_fdi_disable(struct drm_crtc *crtc);
> +void intel_ddi_fdi_disable(struct intel_encoder *,
> +			   struct intel_crtc_state *,
> +			   struct drm_connector_state *);
>  void intel_ddi_get_config(struct intel_encoder *encoder,
>  			  struct intel_crtc_state *pipe_config);
>  struct intel_encoder *
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index de8e9fb51595..107b70c19333 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -535,7 +535,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
>  
>  static void intel_dsi_prepare(struct intel_encoder *intel_encoder);
>  
> -static void intel_dsi_pre_enable(struct intel_encoder *encoder)
> +static void intel_dsi_pre_enable(struct intel_encoder *encoder,
> +				 struct intel_crtc_state *pipe_config,
> +				 struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -582,7 +584,9 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>  	intel_dsi_enable(encoder);
>  }
>  
> -static void intel_dsi_enable_nop(struct intel_encoder *encoder)
> +static void intel_dsi_enable_nop(struct intel_encoder *encoder,
> +				 struct intel_crtc_state *pipe_config,
> +				 struct drm_connector_state *conn_state)
>  {
>  	DRM_DEBUG_KMS("\n");
>  
> @@ -592,7 +596,9 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
>  	 */
>  }
>  
> -static void intel_dsi_pre_disable(struct intel_encoder *encoder)
> +static void intel_dsi_pre_disable(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *old_crtc_state,
> +				  struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>  	enum port port;
> @@ -694,7 +700,9 @@ static void intel_dsi_clear_device_ready(struct intel_encoder *encoder)
>  	intel_disable_dsi_pll(encoder);
>  }
>  
> -static void intel_dsi_post_disable(struct intel_encoder *encoder)
> +static void intel_dsi_post_disable(struct intel_encoder *encoder,
> +				   struct intel_crtc_state *pipe_config,
> +				   struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
> index 47bdf9dad0d3..52dde9b71ca5 100644
> --- a/drivers/gpu/drm/i915/intel_dvo.c
> +++ b/drivers/gpu/drm/i915/intel_dvo.c
> @@ -174,7 +174,9 @@ static void intel_dvo_get_config(struct intel_encoder *encoder,
>  	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
>  }
>  
> -static void intel_disable_dvo(struct intel_encoder *encoder)
> +static void intel_disable_dvo(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *old_crtc_state,
> +			      struct drm_connector_state *old_conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
> @@ -186,7 +188,9 @@ static void intel_disable_dvo(struct intel_encoder *encoder)
>  	I915_READ(dvo_reg);
>  }
>  
> -static void intel_enable_dvo(struct intel_encoder *encoder)
> +static void intel_enable_dvo(struct intel_encoder *encoder,
> +			     struct intel_crtc_state *pipe_config,
> +			     struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dvo *intel_dvo = enc_to_dvo(encoder);
> @@ -253,7 +257,9 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,
>  	return true;
>  }
>  
> -static void intel_dvo_pre_enable(struct intel_encoder *encoder)
> +static void intel_dvo_pre_enable(struct intel_encoder *encoder,
> +				 struct intel_crtc_state *pipe_config,
> +				 struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index 4df9f384910c..560eff9a3694 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -985,7 +985,9 @@ static void intel_enable_hdmi_audio(struct intel_encoder *encoder)
>  	intel_audio_codec_enable(encoder);
>  }
>  
> -static void g4x_enable_hdmi(struct intel_encoder *encoder)
> +static void g4x_enable_hdmi(struct intel_encoder *encoder,
> +			    struct intel_crtc_state *pipe_config,
> +			    struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -1006,7 +1008,9 @@ static void g4x_enable_hdmi(struct intel_encoder *encoder)
>  		intel_enable_hdmi_audio(encoder);
>  }
>  
> -static void ibx_enable_hdmi(struct intel_encoder *encoder)
> +static void ibx_enable_hdmi(struct intel_encoder *encoder,
> +			    struct intel_crtc_state *pipe_config,
> +			    struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -1055,7 +1059,9 @@ static void ibx_enable_hdmi(struct intel_encoder *encoder)
>  		intel_enable_hdmi_audio(encoder);
>  }
>  
> -static void cpt_enable_hdmi(struct intel_encoder *encoder)
> +static void cpt_enable_hdmi(struct intel_encoder *encoder,
> +			    struct intel_crtc_state *pipe_config,
> +			    struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -1108,11 +1114,15 @@ static void cpt_enable_hdmi(struct intel_encoder *encoder)
>  		intel_enable_hdmi_audio(encoder);
>  }
>  
> -static void vlv_enable_hdmi(struct intel_encoder *encoder)
> +static void vlv_enable_hdmi(struct intel_encoder *encoder,
> +			    struct intel_crtc_state *pipe_config,
> +			    struct drm_connector_state *conn_state)
>  {
>  }
>  
> -static void intel_disable_hdmi(struct intel_encoder *encoder)
> +static void intel_disable_hdmi(struct intel_encoder *encoder,
> +			       struct intel_crtc_state *old_crtc_state,
> +			       struct drm_connector_state *old_conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -1164,17 +1174,21 @@ static void intel_disable_hdmi(struct intel_encoder *encoder)
>  	intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
>  }
>  
> -static void g4x_disable_hdmi(struct intel_encoder *encoder)
> +static void g4x_disable_hdmi(struct intel_encoder *encoder,
> +			     struct intel_crtc_state *old_crtc_state,
> +			     struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
>  
>  	if (crtc->config->has_audio)
>  		intel_audio_codec_disable(encoder);
>  
> -	intel_disable_hdmi(encoder);
> +	intel_disable_hdmi(encoder, old_crtc_state, old_conn_state);
>  }
>  
> -static void pch_disable_hdmi(struct intel_encoder *encoder)
> +static void pch_disable_hdmi(struct intel_encoder *encoder,
> +			     struct intel_crtc_state *old_crtc_state,
> +			     struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
>  
> @@ -1182,9 +1196,11 @@ static void pch_disable_hdmi(struct intel_encoder *encoder)
>  		intel_audio_codec_disable(encoder);
>  }
>  
> -static void pch_post_disable_hdmi(struct intel_encoder *encoder)
> +static void pch_post_disable_hdmi(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *old_crtc_state,
> +				  struct drm_connector_state *old_conn_state)
>  {
> -	intel_disable_hdmi(encoder);
> +	intel_disable_hdmi(encoder, old_crtc_state, old_conn_state);
>  }
>  
>  static int intel_hdmi_source_max_tmds_clock(struct drm_i915_private *dev_priv)
> @@ -1638,7 +1654,9 @@ done:
>  	return 0;
>  }
>  
> -static void intel_hdmi_pre_enable(struct intel_encoder *encoder)
> +static void intel_hdmi_pre_enable(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
>  	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> @@ -1651,7 +1669,9 @@ static void intel_hdmi_pre_enable(struct intel_encoder *encoder)
>  				   adjusted_mode);
>  }
>  
> -static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
> +static void vlv_hdmi_pre_enable(struct intel_encoder *encoder,
> +				struct intel_crtc_state *pipe_config,
> +				struct drm_connector_state *conn_state)
>  {
>  	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>  	struct intel_hdmi *intel_hdmi = &dport->hdmi;
> @@ -1671,37 +1691,47 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
>  				   intel_crtc->config->has_hdmi_sink,
>  				   adjusted_mode);
>  
> -	g4x_enable_hdmi(encoder);
> +	g4x_enable_hdmi(encoder, pipe_config, conn_state);
>  
>  	vlv_wait_port_ready(dev_priv, dport, 0x0);
>  }
>  
> -static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder)
> +static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	intel_hdmi_prepare(encoder);
>  
>  	vlv_phy_pre_pll_enable(encoder);
>  }
>  
> -static void chv_hdmi_pre_pll_enable(struct intel_encoder *encoder)
> +static void chv_hdmi_pre_pll_enable(struct intel_encoder *encoder,
> +				    struct intel_crtc_state *pipe_config,
> +				    struct drm_connector_state *conn_state)
>  {
>  	intel_hdmi_prepare(encoder);
>  
>  	chv_phy_pre_pll_enable(encoder);
>  }
>  
> -static void chv_hdmi_post_pll_disable(struct intel_encoder *encoder)
> +static void chv_hdmi_post_pll_disable(struct intel_encoder *encoder,
> +				      struct intel_crtc_state *old_crtc_state,
> +				      struct drm_connector_state *old_conn_state)
>  {
>  	chv_phy_post_pll_disable(encoder);
>  }
>  
> -static void vlv_hdmi_post_disable(struct intel_encoder *encoder)
> +static void vlv_hdmi_post_disable(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *old_crtc_state,
> +				  struct drm_connector_state *old_conn_state)
>  {
>  	/* Reset lanes to avoid HDMI flicker (VLV w/a) */
>  	vlv_phy_reset_lanes(encoder);
>  }
>  
> -static void chv_hdmi_post_disable(struct intel_encoder *encoder)
> +static void chv_hdmi_post_disable(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *old_crtc_state,
> +				  struct drm_connector_state *old_conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -1714,7 +1744,9 @@ static void chv_hdmi_post_disable(struct intel_encoder *encoder)
>  	mutex_unlock(&dev_priv->sb_lock);
>  }
>  
> -static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
> +static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
> +				struct intel_crtc_state *pipe_config,
> +				struct drm_connector_state *conn_state)
>  {
>  	struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
>  	struct intel_hdmi *intel_hdmi = &dport->hdmi;
> @@ -1734,7 +1766,7 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
>  				   intel_crtc->config->has_hdmi_sink,
>  				   adjusted_mode);
>  
> -	g4x_enable_hdmi(encoder);
> +	g4x_enable_hdmi(encoder, pipe_config, conn_state);
>  
>  	vlv_wait_port_ready(dev_priv, dport, 0x0);
>  
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 49550470483e..4cae4a8ea491 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -136,7 +136,9 @@ static void intel_lvds_get_config(struct intel_encoder *encoder,
>  	pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
>  }
>  
> -static void intel_pre_enable_lvds(struct intel_encoder *encoder)
> +static void intel_pre_enable_lvds(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *pipe_config,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
>  	struct drm_device *dev = encoder->base.dev;
> @@ -210,7 +212,9 @@ static void intel_pre_enable_lvds(struct intel_encoder *encoder)
>  /**
>   * Sets the power state for the panel.
>   */
> -static void intel_enable_lvds(struct intel_encoder *encoder)
> +static void intel_enable_lvds(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
> @@ -237,7 +241,9 @@ static void intel_enable_lvds(struct intel_encoder *encoder)
>  	intel_panel_enable_backlight(intel_connector);
>  }
>  
> -static void intel_disable_lvds(struct intel_encoder *encoder)
> +static void intel_disable_lvds(struct intel_encoder *encoder,
> +			       struct intel_crtc_state *old_crtc_state,
> +			       struct drm_connector_state *old_conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
> @@ -260,7 +266,10 @@ static void intel_disable_lvds(struct intel_encoder *encoder)
>  	POSTING_READ(lvds_encoder->reg);
>  }
>  
> -static void gmch_disable_lvds(struct intel_encoder *encoder)
> +static void gmch_disable_lvds(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *old_crtc_state,
> +			      struct drm_connector_state *old_conn_state)
> +
>  {
>  	struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
>  	struct intel_connector *intel_connector =
> @@ -268,10 +277,12 @@ static void gmch_disable_lvds(struct intel_encoder *encoder)
>  
>  	intel_panel_disable_backlight(intel_connector);
>  
> -	intel_disable_lvds(encoder);
> +	intel_disable_lvds(encoder, old_crtc_state, old_conn_state);
>  }
>  
> -static void pch_disable_lvds(struct intel_encoder *encoder)
> +static void pch_disable_lvds(struct intel_encoder *encoder,
> +			     struct intel_crtc_state *old_crtc_state,
> +			     struct drm_connector_state *old_conn_state)
>  {
>  	struct intel_lvds_encoder *lvds_encoder = to_lvds_encoder(&encoder->base);
>  	struct intel_connector *intel_connector =
> @@ -280,9 +291,11 @@ static void pch_disable_lvds(struct intel_encoder *encoder)
>  	intel_panel_disable_backlight(intel_connector);
>  }
>  
> -static void pch_post_disable_lvds(struct intel_encoder *encoder)
> +static void pch_post_disable_lvds(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *old_crtc_state,
> +				  struct drm_connector_state *old_conn_state)
>  {
> -	intel_disable_lvds(encoder);
> +	intel_disable_lvds(encoder, old_crtc_state, old_conn_state);
>  }
>  
>  static enum drm_mode_status
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index e378f35365a2..48f5deb6a4cf 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1192,7 +1192,9 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
>  	return true;
>  }
>  
> -static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder)
> +static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder,
> +				  struct intel_crtc_state *crtc_state,
> +				  struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = intel_encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -1434,7 +1436,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
>  	     pipe_config->pixel_multiplier, encoder_pixel_multiplier);
>  }
>  
> -static void intel_disable_sdvo(struct intel_encoder *encoder)
> +static void intel_disable_sdvo(struct intel_encoder *encoder,
> +			       struct intel_crtc_state *old_crtc_state,
> +			       struct drm_connector_state *conn_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
> @@ -1477,16 +1481,22 @@ static void intel_disable_sdvo(struct intel_encoder *encoder)
>  	}
>  }
>  
> -static void pch_disable_sdvo(struct intel_encoder *encoder)
> +static void pch_disable_sdvo(struct intel_encoder *encoder,
> +			     struct intel_crtc_state *old_crtc_state,
> +			     struct drm_connector_state *old_conn_state)
>  {
>  }
>  
> -static void pch_post_disable_sdvo(struct intel_encoder *encoder)
> +static void pch_post_disable_sdvo(struct intel_encoder *encoder,
> +				  struct intel_crtc_state *old_crtc_state,
> +				  struct drm_connector_state *old_conn_state)
>  {
> -	intel_disable_sdvo(encoder);
> +	intel_disable_sdvo(encoder, old_crtc_state, old_conn_state);
>  }
>  
> -static void intel_enable_sdvo(struct intel_encoder *encoder)
> +static void intel_enable_sdvo(struct intel_encoder *encoder,
> +			      struct intel_crtc_state *pipe_config,
> +			      struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
> index 49136ad5473e..440ce7933573 100644
> --- a/drivers/gpu/drm/i915/intel_tv.c
> +++ b/drivers/gpu/drm/i915/intel_tv.c
> @@ -838,7 +838,9 @@ intel_tv_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe)
>  }
>  
>  static void
> -intel_enable_tv(struct intel_encoder *encoder)
> +intel_enable_tv(struct intel_encoder *encoder,
> +		struct intel_crtc_state *pipe_config,
> +		struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -851,7 +853,9 @@ intel_enable_tv(struct intel_encoder *encoder)
>  }
>  
>  static void
> -intel_disable_tv(struct intel_encoder *encoder)
> +intel_disable_tv(struct intel_encoder *encoder,
> +		 struct intel_crtc_state *old_crtc_state,
> +		 struct drm_connector_state *old_conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> @@ -1010,7 +1014,9 @@ static void set_color_conversion(struct drm_i915_private *dev_priv,
>  		   color_conversion->av);
>  }
>  
> -static void intel_tv_pre_enable(struct intel_encoder *encoder)
> +static void intel_tv_pre_enable(struct intel_encoder *encoder,
> +				struct intel_crtc_state *pipe_config,
> +				struct drm_connector_state *conn_state)
>  {
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list