All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/7] drm/i915: Nuke intel_trans_dp_port_sel()
Date: Wed, 23 May 2018 12:26:11 +0300	[thread overview]
Message-ID: <87lgcan2oc.fsf@intel.com> (raw)
In-Reply-To: <20180518152931.13104-3-ville.syrjala@linux.intel.com>

On Fri, 18 May 2018, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> for_each_encoder_on_crtc() is legacy and shouldn't be used by atomic
> drivers. Let's throw out intel_trans_dp_port_sel() and replace it
> with intel_get_crtc_new_encoder() which looks the atomic state instead.
>
> Since we now have to call intel_get_crtc_new_encoder() during the commit
> phase we'll need to plumb in the top level atomic state. The
> crtc_state->state pointers are no longer valid at that point.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++-----------------------
>  1 file changed, 14 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index a85f77aebd12..d36dea568b82 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4594,17 +4594,17 @@ static void ivybridge_update_fdi_bc_bifurcation(struct intel_crtc *intel_crtc)
>   * used when we know that the CRTC isn't feeding multiple encoders!
>   */
>  static struct intel_encoder *
> -intel_get_crtc_new_encoder(const struct intel_crtc_state *crtc_state)
> +intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
> +			   const struct intel_crtc_state *crtc_state)
>  {
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> -	const struct drm_atomic_state *state = crtc_state->base.state;
>  	const struct drm_connector_state *connector_state;
>  	const struct drm_connector *connector;
>  	struct intel_encoder *encoder = NULL;
>  	int num_encoders = 0;
>  	int i;
>  
> -	for_each_new_connector_in_state(state, connector, connector_state, i) {
> +	for_each_new_connector_in_state(&state->base, connector, connector_state, i) {
>  		if (connector_state->crtc != &crtc->base)
>  			continue;
>  
> @@ -4618,22 +4618,6 @@ intel_get_crtc_new_encoder(const struct intel_crtc_state *crtc_state)
>  	return encoder;
>  }
>  
> -/* Return which DP Port should be selected for Transcoder DP control */
> -static enum port
> -intel_trans_dp_port_sel(struct intel_crtc *crtc)
> -{
> -	struct drm_device *dev = crtc->base.dev;
> -	struct intel_encoder *encoder;
> -
> -	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
> -		if (encoder->type == INTEL_OUTPUT_DP ||
> -		    encoder->type == INTEL_OUTPUT_EDP)
> -			return encoder->port;
> -	}
> -
> -	return -1;
> -}

Glad to see this go, fingers crossed the sanity checks in
intel_get_crtc_new_encoder() and ironlake_pch_enable() will give enough
debug details in case this goes boom. ;)

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> -
>  /*
>   * Enable PCH resources required for PCH ports:
>   *   - PCH PLLs
> @@ -4642,7 +4626,8 @@ intel_trans_dp_port_sel(struct intel_crtc *crtc)
>   *   - DP transcoding bits
>   *   - transcoder
>   */
> -static void ironlake_pch_enable(const struct intel_crtc_state *crtc_state)
> +static void ironlake_pch_enable(const struct intel_atomic_state *state,
> +				const struct intel_crtc_state *crtc_state)
>  {
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
>  	struct drm_device *dev = crtc->base.dev;
> @@ -4715,7 +4700,7 @@ static void ironlake_pch_enable(const struct intel_crtc_state *crtc_state)
>  		if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
>  			temp |= TRANS_DP_VSYNC_ACTIVE_HIGH;
>  
> -		port = intel_trans_dp_port_sel(crtc);
> +		port = intel_get_crtc_new_encoder(state, crtc_state)->port;
>  		WARN_ON(port < PORT_B || port > PORT_D);
>  		temp |= TRANS_DP_PORT_SEL(port);
>  
> @@ -4725,7 +4710,8 @@ static void ironlake_pch_enable(const struct intel_crtc_state *crtc_state)
>  	ironlake_enable_pch_transcoder(dev_priv, pipe);
>  }
>  
> -static void lpt_pch_enable(const struct intel_crtc_state *crtc_state)
> +static void lpt_pch_enable(const struct intel_atomic_state *state,
> +			   const struct intel_crtc_state *crtc_state)
>  {
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
>  	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
> @@ -5528,7 +5514,7 @@ static void ironlake_crtc_enable(struct intel_crtc_state *pipe_config,
>  	intel_enable_pipe(pipe_config);
>  
>  	if (intel_crtc->config->has_pch_encoder)
> -		ironlake_pch_enable(pipe_config);
> +		ironlake_pch_enable(old_intel_state, pipe_config);
>  
>  	assert_vblank_disabled(crtc);
>  	drm_crtc_vblank_on(crtc);
> @@ -5667,7 +5653,7 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,
>  		intel_enable_pipe(pipe_config);
>  
>  	if (intel_crtc->config->has_pch_encoder)
> -		lpt_pch_enable(pipe_config);
> +		lpt_pch_enable(old_intel_state, pipe_config);
>  
>  	if (intel_crtc_has_type(intel_crtc->config, INTEL_OUTPUT_DP_MST))
>  		intel_ddi_set_vc_payload_alloc(pipe_config, true);
> @@ -9121,9 +9107,12 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv)
>  static int haswell_crtc_compute_clock(struct intel_crtc *crtc,
>  				      struct intel_crtc_state *crtc_state)
>  {
> +	struct intel_atomic_state *state =
> +		to_intel_atomic_state(crtc_state->base.state);
> +
>  	if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DSI)) {
>  		struct intel_encoder *encoder =
> -			intel_get_crtc_new_encoder(crtc_state);
> +			intel_get_crtc_new_encoder(state, crtc_state);
>  
>  		if (!intel_get_shared_dpll(crtc, crtc_state, encoder)) {
>  			DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-05-23  9:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 15:29 [PATCH 1/7] drm/i915: Move intel_ddi_get_crtc_new_encoder() out from ddi code Ville Syrjala
2018-05-18 15:29 ` [PATCH v2 2/7] drm/i915: Parametrize TRANS_DP_PORT_SEL Ville Syrjala
2018-05-23  9:14   ` Jani Nikula
2018-05-18 15:29 ` [PATCH 3/7] drm/i915: Nuke intel_trans_dp_port_sel() Ville Syrjala
2018-05-23  9:26   ` Jani Nikula [this message]
2018-05-18 15:29 ` [PATCH v3 4/7] drm/i915: Clean up DP pipe select bits Ville Syrjala
2018-05-23  9:37   ` Jani Nikula
2018-05-18 15:29 ` [PATCH 5/7] drm/i915: Allow eDP on port C in theory Ville Syrjala
2018-05-23  9:38   ` Jani Nikula
2018-05-18 15:29 ` [PATCH 6/7] drm/i915: Implement the missing bits of assert_panel_unlocked() Ville Syrjala
2018-05-23  9:42   ` Jani Nikula
2018-05-23 11:48     ` Ville Syrjälä
2018-05-18 15:29 ` [PATCH 7/7] drm/i915: WARN if power sequencer is not connected to the LVDS port on pre-ilk Ville Syrjala
2018-05-23  9:43   ` Jani Nikula
2018-05-23 14:29     ` Ville Syrjälä
2018-05-18 16:10 ` ✓ Fi.CI.BAT: success for series starting with [1/7] drm/i915: Move intel_ddi_get_crtc_new_encoder() out from ddi code Patchwork
2018-05-18 23:21 ` ✓ Fi.CI.IGT: " Patchwork
2018-05-23  9:13 ` [PATCH 1/7] " Jani Nikula

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=87lgcan2oc.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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.