All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 01/10] drm/i915: Eliminate some encoder->crtc usage from DP code
Date: Thu, 9 Nov 2017 16:36:08 +0200	[thread overview]
Message-ID: <20171109143608.GQ10981@intel.com> (raw)
In-Reply-To: <1510192529.8287.22.camel@dk-H97M-D3H>

On Thu, Nov 09, 2017 at 01:35:01AM +0000, Pandiyan, Dhinakaran wrote:
> 
> On Tue, 2017-10-31 at 22:51 +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Extract the current crtc from the crtc state rather than via
> > the legacy encoder->crtc pointer whenever possible.
> > 
> 
> There are still some encoder->crtc remaining. How much of a problem is
> this?

The ones that are left are link training and sink crc stuff mostly IIRC.
Those should get cleaned up, but they require a bit more than a trivial
conversion.

It's not a real problem having those. Things should still work
correctly given that we do update the legacy pointers somewhere.

> 
> 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c | 63 +++++++++++++++++++----------------------
> >  1 file changed, 29 insertions(+), 34 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index d27c0145ac91..4f64d83537d9 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -129,10 +129,12 @@ static struct intel_dp *intel_attached_dp(struct drm_connector *connector)
> >  	return enc_to_intel_dp(&intel_attached_encoder(connector)->base);
> >  }
> >  
> > -static void intel_dp_link_down(struct intel_dp *intel_dp);
> > +static void intel_dp_link_down(struct intel_encoder *encoder,
> > +			       const struct intel_crtc_state *old_crtc_state);
> >  static bool edp_panel_vdd_on(struct intel_dp *intel_dp);
> >  static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync);
> > -static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp);
> > +static void vlv_init_panel_power_sequencer(struct intel_encoder *encoder,
> > +					   const struct intel_crtc_state *crtc_state);
> >  static void vlv_steal_power_sequencer(struct drm_device *dev,
> >  				      enum pipe pipe);
> >  static void intel_dp_unset_edid(struct intel_dp *intel_dp);
> > @@ -1858,7 +1860,7 @@ static void intel_dp_prepare(struct intel_encoder *encoder,
> >  	struct drm_i915_private *dev_priv = to_i915(dev);
> >  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> >  	enum port port = dp_to_dig_port(intel_dp)->port;
> > -	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
> > +	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
> >  	const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
> >  
> >  	intel_dp_set_link_params(intel_dp, pipe_config->port_clock,
> > @@ -2491,10 +2493,10 @@ static void ironlake_edp_pll_on(struct intel_dp *intel_dp,
> >  	udelay(200);
> >  }
> >  
> > -static void ironlake_edp_pll_off(struct intel_dp *intel_dp)
> > +static void ironlake_edp_pll_off(struct intel_dp *intel_dp,
> > +				 const struct intel_crtc_state *old_crtc_state)
> >  {
> > -	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> > -	struct intel_crtc *crtc = to_intel_crtc(intel_dig_port->base.base.crtc);
> > +	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->base.crtc);
> >  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> >  
> >  	assert_pipe_disabled(dev_priv, crtc->pipe);
> > @@ -2624,7 +2626,7 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
> >  	struct drm_device *dev = encoder->base.dev;
> >  	struct drm_i915_private *dev_priv = to_i915(dev);
> >  	enum port port = dp_to_dig_port(intel_dp)->port;
> > -	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
> > +	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
> >  
> >  	if (encoder->type == INTEL_OUTPUT_EDP)
> >  		pipe_config->output_types |= BIT(INTEL_OUTPUT_EDP);
> > @@ -2723,12 +2725,10 @@ static void g4x_disable_dp(struct intel_encoder *encoder,
> >  			   const struct intel_crtc_state *old_crtc_state,
> >  			   const struct drm_connector_state *old_conn_state)
> >  {
> > -	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> > -
> >  	intel_disable_dp(encoder, old_crtc_state, old_conn_state);
> >  
> >  	/* disable the port before the pipe on g4x */
> > -	intel_dp_link_down(intel_dp);
> > +	intel_dp_link_down(encoder, old_crtc_state);
> >  }
> >  
> >  static void ilk_disable_dp(struct intel_encoder *encoder,
> > @@ -2754,33 +2754,29 @@ static void ilk_post_disable_dp(struct intel_encoder *encoder,
> >  				const 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;
> > +	enum port port = encoder->port;
> >  
> > -	intel_dp_link_down(intel_dp);
> > +	intel_dp_link_down(encoder, old_crtc_state);
> >  
> >  	/* Only ilk+ has port A */
> >  	if (port == PORT_A)
> > -		ironlake_edp_pll_off(intel_dp);
> > +		ironlake_edp_pll_off(intel_dp, old_crtc_state);
> >  }
> >  
> >  static void vlv_post_disable_dp(struct intel_encoder *encoder,
> >  				const struct intel_crtc_state *old_crtc_state,
> >  				const struct drm_connector_state *old_conn_state)
> >  {
> > -	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> > -
> > -	intel_dp_link_down(intel_dp);
> > +	intel_dp_link_down(encoder, old_crtc_state);
> >  }
> >  
> >  static void chv_post_disable_dp(struct intel_encoder *encoder,
> >  				const struct intel_crtc_state *old_crtc_state,
> >  				const 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;
> > -	struct drm_i915_private *dev_priv = to_i915(dev);
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  
> > -	intel_dp_link_down(intel_dp);
> > +	intel_dp_link_down(encoder, old_crtc_state);
> >  
> >  	mutex_lock(&dev_priv->sb_lock);
> >  
> > @@ -2909,7 +2905,7 @@ static void intel_enable_dp(struct intel_encoder *encoder,
> >  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> >  	struct drm_device *dev = encoder->base.dev;
> >  	struct drm_i915_private *dev_priv = to_i915(dev);
> > -	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
> > +	struct intel_crtc *crtc = to_intel_crtc(pipe_config->base.crtc);
> >  	uint32_t dp_reg = I915_READ(intel_dp->output_reg);
> >  	enum pipe pipe = crtc->pipe;
> >  
> > @@ -2919,7 +2915,7 @@ static void intel_enable_dp(struct intel_encoder *encoder,
> >  	pps_lock(intel_dp);
> >  
> >  	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
> > -		vlv_init_panel_power_sequencer(intel_dp);
> > +		vlv_init_panel_power_sequencer(encoder, pipe_config);
> >  
> >  	intel_dp_enable_port(intel_dp, pipe_config);
> >  
> > @@ -3047,13 +3043,13 @@ static void vlv_steal_power_sequencer(struct drm_device *dev,
> >  	}
> >  }
> >  
> > -static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp)
> > +static void vlv_init_panel_power_sequencer(struct intel_encoder *encoder,
> > +					   const struct intel_crtc_state *crtc_state)
> >  {
> > -	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> > -	struct intel_encoder *encoder = &intel_dig_port->base;
> > +	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> >  	struct drm_device *dev = encoder->base.dev;
> >  	struct drm_i915_private *dev_priv = to_i915(dev);
> > -	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
> > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> >  
> >  	lockdep_assert_held(&dev_priv->pps_mutex);
> >  
> > @@ -3084,7 +3080,7 @@ static void vlv_init_panel_power_sequencer(struct intel_dp *intel_dp)
> >  	intel_dp->pps_pipe = crtc->pipe;
> >  
> >  	DRM_DEBUG_KMS("initializing pipe %c power sequencer for port %c\n",
> > -		      pipe_name(intel_dp->pps_pipe), port_name(intel_dig_port->port));
> > +		      pipe_name(intel_dp->pps_pipe), port_name(encoder->port));
> >  
> >  	/* init power sequencer on this pipe and port */
> >  	intel_dp_init_panel_power_sequencer(dev, intel_dp);
> > @@ -3624,13 +3620,13 @@ void intel_dp_set_idle_link_train(struct intel_dp *intel_dp)
> >  }
> >  
> >  static void
> > -intel_dp_link_down(struct intel_dp *intel_dp)
> > +intel_dp_link_down(struct intel_encoder *encoder,
> > +		   const struct intel_crtc_state *old_crtc_state)
> >  {
> > -	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> > -	struct intel_crtc *crtc = to_intel_crtc(intel_dig_port->base.base.crtc);
> > -	enum port port = intel_dig_port->port;
> > -	struct drm_device *dev = intel_dig_port->base.base.dev;
> > -	struct drm_i915_private *dev_priv = to_i915(dev);
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > +	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> > +	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->base.crtc);
> > +	enum port port = encoder->port;
> >  	uint32_t DP = intel_dp->DP;
> >  
> >  	if (WARN_ON(HAS_DDI(dev_priv)))
> > @@ -5493,7 +5489,6 @@ static void intel_dp_set_drrs_state(struct drm_i915_private *dev_priv,
> >  
> >  	dig_port = dp_to_dig_port(intel_dp);
> >  	encoder = &dig_port->base;
> > -	intel_crtc = to_intel_crtc(encoder->base.crtc);
> >  
> >  	if (!intel_crtc) {
> >  		DRM_DEBUG_KMS("DRRS: intel_crtc not initialized\n");

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-11-09 14:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 20:51 [PATCH 00/10] drm/i915: Nuke dig_port->port and assorted cleanups Ville Syrjala
2017-10-31 20:51 ` [PATCH 01/10] drm/i915: Eliminate some encoder->crtc usage from DP code Ville Syrjala
2017-11-09  1:35   ` Pandiyan, Dhinakaran
2017-11-09 14:36     ` Ville Syrjälä [this message]
2017-10-31 20:51 ` [PATCH 02/10] drm/i915: Eliminate some encoder->crtc usage from DSI code Ville Syrjala
2017-11-09  1:36   ` Pandiyan, Dhinakaran
2017-11-09 14:43     ` Ville Syrjälä
2017-10-31 20:51 ` [PATCH 03/10] drm/i915: Eliminate some encoder->crtc usage from SDVO code Ville Syrjala
2017-10-31 20:51 ` [PATCH 04/10] drm/i915: Eliminate some encoder->crtc usage from TV code Ville Syrjala
2017-10-31 20:51 ` [PATCH 05/10] drm/i915: Pass crtc state to DPIO PHY functions Ville Syrjala
2017-10-31 20:51 ` [PATCH 06/10] drm/i915: Eliminate crtc->config usage from CRT code Ville Syrjala
2017-10-31 20:51 ` [PATCH 07/10] drm/i915: Replace dig_port->port with encoder port for BXT DPLL selection Ville Syrjala
2017-10-31 20:51 ` [PATCH 08/10] drm/i915: Nuke intel_digital_port->port Ville Syrjala
2017-11-09  1:37   ` Pandiyan, Dhinakaran
2017-11-09 13:50     ` Ville Syrjälä
2017-11-09 15:24   ` [PATCH v2 " Ville Syrjala
2017-10-31 20:51 ` [PATCH 09/10] drm/i915: Clean up PPS code calling conventions Ville Syrjala
2017-10-31 20:51 ` [PATCH 10/10] drm/i915: Clean up DP code local variables and " Ville Syrjala
2017-11-09  3:01   ` Pandiyan, Dhinakaran
2017-11-09 15:27     ` Ville Syrjälä
2017-11-09 15:27   ` [PATCH v2 " Ville Syrjala
2017-10-31 22:31 ` ✗ Fi.CI.BAT: warning for drm/i915: Nuke dig_port->port and assorted cleanups Patchwork
2017-11-01  9:55 ` [PATCH 00/10] " Jani Nikula
2017-11-09  3:08   ` Pandiyan, Dhinakaran
2017-11-09 18:26     ` Ville Syrjälä
2017-11-09 16:01 ` ✓ Fi.CI.BAT: success for drm/i915: Nuke dig_port->port and assorted cleanups (rev3) Patchwork
2017-11-09 16:59 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171109143608.GQ10981@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.