All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Navare, Manasi" <manasi.d.navare@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 15/16] drm/i915: Reduce bigjoiner special casing
Date: Wed, 20 Oct 2021 16:52:52 -0700	[thread overview]
Message-ID: <20211020235252.GA26429@labuser-Z97X-UD5H> (raw)
In-Reply-To: <20210913144440.23008-16-ville.syrjala@linux.intel.com>

On Mon, Sep 13, 2021 at 05:44:39PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Try to make bigjoiner pipes less special.
> 
> The main things here are that each pipe now does full
> clock computation/readout with its own shared_dpll reference.
> Also every pipe's cpu_transcoder always points correctly
> at the master transcoder.
> 
> Due to the above changes state readout is now complete
> and all the related hacks can go away. The actual modeset
> sequence code is still a mess, but I think in order to clean
> that up properly we're probably going to have to redesign
> the modeset logic to treat transcoders vs. pipes separately.
> That is going to require significant amounts of work.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

This cleanup and making both slave and master generic makes sense and lot cleaner

Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>

Manasi

> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c     |  16 +--
>  drivers/gpu/drm/i915/display/intel_display.c | 132 ++++++-------------
>  2 files changed, 40 insertions(+), 108 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index f51c5d732d41..6a068a57f6d2 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3615,18 +3615,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder,
>  	if (drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder)))
>  		return;
>  
> -	if (pipe_config->bigjoiner_slave) {
> -		/* read out pipe settings from master */
> -		enum transcoder save = pipe_config->cpu_transcoder;
> -
> -		/* Our own transcoder needs to be disabled when reading it in intel_ddi_read_func_ctl() */
> -		WARN_ON(pipe_config->output_types);
> -		pipe_config->cpu_transcoder = (enum transcoder)pipe_config->bigjoiner_linked_crtc->pipe;
> -		intel_ddi_read_func_ctl(encoder, pipe_config);
> -		pipe_config->cpu_transcoder = save;
> -	} else {
> -		intel_ddi_read_func_ctl(encoder, pipe_config);
> -	}
> +	intel_ddi_read_func_ctl(encoder, pipe_config);
>  
>  	intel_ddi_mso_get_config(encoder, pipe_config);
>  
> @@ -3654,8 +3643,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder,
>  		dev_priv->vbt.edp.bpp = pipe_config->pipe_bpp;
>  	}
>  
> -	if (!pipe_config->bigjoiner_slave)
> -		ddi_dotclock_get(pipe_config);
> +	ddi_dotclock_get(pipe_config);
>  
>  	if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv))
>  		pipe_config->lane_lat_optim_mask =
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 25ae9e4f6b66..17d12d12bc0a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2027,15 +2027,17 @@ struct intel_encoder *
>  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->uapi.crtc);
>  	const struct drm_connector_state *connector_state;
>  	const struct drm_connector *connector;
>  	struct intel_encoder *encoder = NULL;
> +	struct intel_crtc *master_crtc;
>  	int num_encoders = 0;
>  	int i;
>  
> +	master_crtc = intel_master_crtc(crtc_state);
> +
>  	for_each_new_connector_in_state(&state->base, connector, connector_state, i) {
> -		if (connector_state->crtc != &crtc->base)
> +		if (connector_state->crtc != &master_crtc->base)
>  			continue;
>  
>  		encoder = to_intel_encoder(connector_state->best_encoder);
> @@ -2044,7 +2046,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
>  
>  	drm_WARN(encoder->base.dev, num_encoders != 1,
>  		 "%d encoders for pipe %c\n",
> -		 num_encoders, pipe_name(crtc->pipe));
> +		 num_encoders, pipe_name(master_crtc->pipe));
>  
>  	return encoder;
>  }
> @@ -3005,20 +3007,20 @@ static void icl_ddi_bigjoiner_pre_enable(struct intel_atomic_state *state,
>  		break;
>  	}
>  
> -	if (!crtc_state->bigjoiner_slave) {
> -		/* need to enable VDSC, which we skipped in pre-enable */
> -		intel_dsc_enable(crtc_state);
> -	} else {
> -		/*
> -		 * Enable sequence steps 1-7 on bigjoiner master
> -		 */
> +	/*
> +	 * Enable sequence steps 1-7 on bigjoiner master
> +	 */
> +	if (crtc_state->bigjoiner_slave)
>  		intel_encoders_pre_pll_enable(state, master_crtc);
> -		if (master_crtc_state->shared_dpll)
> -			intel_enable_shared_dpll(master_crtc_state);
> +
> +	if (crtc_state->shared_dpll)
> +		intel_enable_shared_dpll(crtc_state);
> +
> +	if (crtc_state->bigjoiner_slave)
>  		intel_encoders_pre_enable(state, master_crtc);
>  
> -		intel_dsc_enable(crtc_state);
> -	}
> +	/* need to enable VDSC, which we skipped in pre-enable */
> +	intel_dsc_enable(crtc_state);
>  
>  	if (DISPLAY_VER(dev_priv) >= 13)
>  		intel_uncompressed_joiner_enable(crtc_state);
> @@ -3201,12 +3203,17 @@ static void ilk_crtc_disable(struct intel_atomic_state *state,
>  static void hsw_crtc_disable(struct intel_atomic_state *state,
>  			     struct intel_crtc *crtc)
>  {
> +	const struct intel_crtc_state *old_crtc_state =
> +		intel_atomic_get_old_crtc_state(state, crtc);
> +
>  	/*
>  	 * FIXME collapse everything to one hook.
>  	 * Need care with mst->ddi interactions.
>  	 */
> -	intel_encoders_disable(state, crtc);
> -	intel_encoders_post_disable(state, crtc);
> +	if (!old_crtc_state->bigjoiner_slave) {
> +		intel_encoders_disable(state, crtc);
> +		intel_encoders_post_disable(state, crtc);
> +	}
>  }
>  
>  static void i9xx_pfit_enable(const struct intel_crtc_state *crtc_state)
> @@ -5912,17 +5919,10 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
>  	if (DISPLAY_VER(dev_priv) >= 13 && !pipe_config->dsc.compression_enable)
>  		intel_uncompressed_joiner_get_config(pipe_config);
>  
> -	if (!active) {
> -		/* bigjoiner slave doesn't enable transcoder */
> -		if (!pipe_config->bigjoiner_slave)
> -			goto out;
> +	if (!active)
> +		goto out;
>  
> -		active = true;
> -		pipe_config->pixel_multiplier = 1;
> -
> -		/* we cannot read out most state, so don't bother.. */
> -		pipe_config->quirks |= PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE;
> -	} else if (!transcoder_is_dsi(pipe_config->cpu_transcoder) ||
> +	if (!transcoder_is_dsi(pipe_config->cpu_transcoder) ||
>  	    DISPLAY_VER(dev_priv) >= 11) {
>  		hsw_get_ddi_port_state(crtc, pipe_config);
>  		intel_get_transcoder_timings(crtc, pipe_config);
> @@ -5994,10 +5994,7 @@ static bool hsw_get_pipe_config(struct intel_crtc *crtc,
>  		}
>  	}
>  
> -	if (pipe_config->bigjoiner_slave) {
> -		/* Cannot be read out as a slave, set to 0. */
> -		pipe_config->pixel_multiplier = 0;
> -	} else if (pipe_config->cpu_transcoder != TRANSCODER_EDP &&
> +	if (pipe_config->cpu_transcoder != TRANSCODER_EDP &&
>  	    !transcoder_is_dsi(pipe_config->cpu_transcoder)) {
>  		pipe_config->pixel_multiplier =
>  			intel_de_read(dev_priv,
> @@ -6845,7 +6842,6 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
>  
>  	if (mode_changed && crtc_state->hw.enable &&
>  	    dev_priv->display.crtc_compute_clock &&
> -	    !crtc_state->bigjoiner_slave &&
>  	    !drm_WARN_ON(&dev_priv->drm, crtc_state->shared_dpll)) {
>  		ret = dev_priv->display.crtc_compute_clock(crtc_state);
>  		if (ret)
> @@ -7463,7 +7459,6 @@ copy_bigjoiner_crtc_state(struct intel_crtc_state *crtc_state,
>  			  const struct intel_crtc_state *from_crtc_state)
>  {
>  	struct intel_crtc_state *saved_state;
> -	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  
>  	saved_state = kmemdup(from_crtc_state, sizeof(*saved_state), GFP_KERNEL);
>  	if (!saved_state)
> @@ -7493,8 +7488,8 @@ copy_bigjoiner_crtc_state(struct intel_crtc_state *crtc_state,
>  	crtc_state->nv12_planes = crtc_state->c8_planes = crtc_state->update_planes = 0;
>  	crtc_state->bigjoiner_linked_crtc = to_intel_crtc(from_crtc_state->uapi.crtc);
>  	crtc_state->bigjoiner_slave = true;
> -	crtc_state->cpu_transcoder = (enum transcoder)crtc->pipe;
> -	crtc_state->has_audio = false;
> +	crtc_state->cpu_transcoder = from_crtc_state->cpu_transcoder;
> +	crtc_state->has_audio = from_crtc_state->has_audio;
>  
>  	return 0;
>  }
> @@ -8581,10 +8576,6 @@ verify_crtc_state(struct intel_crtc *crtc,
>  	if (!new_crtc_state->hw.active)
>  		return;
>  
> -	if (new_crtc_state->bigjoiner_slave)
> -		/* No PLLs set for slave */
> -		pipe_config->shared_dpll = NULL;
> -
>  	intel_pipe_config_sanity_check(dev_priv, pipe_config);
>  
>  	if (!intel_pipe_config_compare(new_crtc_state,
> @@ -8703,9 +8694,6 @@ verify_mpllb_state(struct intel_atomic_state *state,
>  	if (!new_crtc_state->hw.active)
>  		return;
>  
> -	if (new_crtc_state->bigjoiner_slave)
> -		return;
> -
>  	encoder = intel_get_crtc_new_encoder(state, new_crtc_state);
>  	intel_mpllb_readout_hw_state(encoder, &mpllb_hw_state);
>  
> @@ -9915,16 +9903,6 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
>  {
>  	struct drm_i915_private *dev_priv = to_i915(state->base.dev);
>  
> -	drm_WARN_ON(&dev_priv->drm, old_crtc_state->bigjoiner_slave);
> -
> -	/*
> -	 * We still need special handling for disabling bigjoiner master
> -	 * and slaves since for slave we do not have encoder or plls
> -	 * so we dont need to disable those.
> -	 */
> -	if (old_crtc_state->bigjoiner)
> -		old_crtc_state->bigjoiner_linked_crtc->active = false;
> -
>  	/*
>  	 * We need to disable pipe CRC before disabling the pipe,
>  	 * or we race against vblank off.
> @@ -9965,7 +9943,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
>  	/* Only disable port sync and MST slaves */
>  	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
>  					    new_crtc_state, i) {
> -		if (!intel_crtc_needs_modeset(new_crtc_state) || old_crtc_state->bigjoiner)
> +		if (!intel_crtc_needs_modeset(new_crtc_state))
>  			continue;
>  
>  		if (!old_crtc_state->hw.active)
> @@ -9977,7 +9955,8 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
>  		 * Slave vblanks are masked till Master Vblanks.
>  		 */
>  		if (!is_trans_port_sync_slave(old_crtc_state) &&
> -		    !intel_dp_mst_is_slave_trans(old_crtc_state))
> +		    !intel_dp_mst_is_slave_trans(old_crtc_state) &&
> +		    !old_crtc_state->bigjoiner_slave)
>  			continue;
>  
>  		intel_old_crtc_state_disables(state, old_crtc_state,
> @@ -9989,13 +9968,14 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
>  	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
>  					    new_crtc_state, i) {
>  		if (!intel_crtc_needs_modeset(new_crtc_state) ||
> -		    (handled & BIT(crtc->pipe)) ||
> -		    old_crtc_state->bigjoiner_slave)
> +		    (handled & BIT(crtc->pipe)))
>  			continue;
>  
> -		if (old_crtc_state->hw.active)
> -			intel_old_crtc_state_disables(state, old_crtc_state,
> -						      new_crtc_state, crtc);
> +		if (!old_crtc_state->hw.active)
> +			continue;
> +
> +		intel_old_crtc_state_disables(state, old_crtc_state,
> +					      new_crtc_state, crtc);
>  	}
>  }
>  
> @@ -12373,9 +12353,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>  		struct intel_plane *plane;
>  		int min_cdclk = 0;
>  
> -		if (crtc_state->bigjoiner_slave)
> -			continue;
> -
>  		if (crtc_state->hw.active) {
>  			/*
>  			 * The initial mode needs to be set in order to keep
> @@ -12435,39 +12412,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>  		intel_bw_crtc_update(bw_state, crtc_state);
>  
>  		intel_pipe_config_sanity_check(dev_priv, crtc_state);
> -
> -		/* discard our incomplete slave state, copy it from master */
> -		if (crtc_state->bigjoiner && crtc_state->hw.active) {
> -			struct intel_crtc *slave = crtc_state->bigjoiner_linked_crtc;
> -			struct intel_crtc_state *slave_crtc_state =
> -				to_intel_crtc_state(slave->base.state);
> -
> -			copy_bigjoiner_crtc_state(slave_crtc_state, crtc_state);
> -			slave->base.mode = crtc->base.mode;
> -
> -			cdclk_state->min_cdclk[slave->pipe] = min_cdclk;
> -			cdclk_state->min_voltage_level[slave->pipe] =
> -				crtc_state->min_voltage_level;
> -
> -			for_each_intel_plane_on_crtc(&dev_priv->drm, slave, plane) {
> -				const struct intel_plane_state *plane_state =
> -					to_intel_plane_state(plane->base.state);
> -
> -				/*
> -				 * FIXME don't have the fb yet, so can't
> -				 * use intel_plane_data_rate() :(
> -				 */
> -				if (plane_state->uapi.visible)
> -					crtc_state->data_rate[plane->id] =
> -						4 * crtc_state->pixel_rate;
> -				else
> -					crtc_state->data_rate[plane->id] = 0;
> -			}
> -
> -			intel_bw_crtc_update(bw_state, slave_crtc_state);
> -			drm_calc_timestamping_constants(&slave->base,
> -							&slave_crtc_state->hw.adjusted_mode);
> -		}
>  	}
>  }
>  
> -- 
> 2.32.0
> 

  reply	other threads:[~2021-10-20 23:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 14:44 [Intel-gfx] [PATCH 00/16] drm/i915: Fix bigjoiner state readout Ville Syrjala
2021-09-13 14:44 ` [Intel-gfx] [PATCH 01/16] Revert "drm/i915/display: Disable audio, DRRS and PSR before planes" Ville Syrjala
2021-09-13 16:28   ` Souza, Jose
2021-09-14  8:20     ` Ville Syrjälä
2021-09-14 23:24       ` Souza, Jose
2021-09-15  0:00         ` Souza, Jose
2021-09-15 12:30           ` Ville Syrjälä
2021-09-15 20:19             ` Souza, Jose
2021-09-16 13:21               ` Ville Syrjälä
2021-09-17  0:14                 ` Souza, Jose
2021-09-13 14:44 ` [Intel-gfx] [PATCH 02/16] drm/i915: Disable all planes before modesetting any pipes Ville Syrjala
2021-09-20  7:52   ` Navare, Manasi
2021-09-21 12:49     ` Ville Syrjälä
2021-09-27 11:20       ` Navare, Manasi
2021-09-13 14:44 ` [Intel-gfx] [PATCH 03/16] drm/i915: Extract intel_dp_use_bigjoiner() Ville Syrjala
2021-09-15 10:12   ` Jani Nikula
2021-09-15 15:39     ` Ville Syrjälä
2021-09-21 11:10   ` Navare, Manasi
2021-09-13 14:44 ` [Intel-gfx] [PATCH 04/16] drm/i915: Flatten hsw_crtc_compute_clock() Ville Syrjala
2021-09-15 10:13   ` Jani Nikula
2021-09-13 14:44 ` [Intel-gfx] [PATCH 05/16] drm/i915: s/pipe/transcoder/ when dealing with PIPECONF/TRANSCONF Ville Syrjala
2021-09-15 10:16   ` Jani Nikula
2021-09-15 13:00     ` Ville Syrjälä
2021-09-15 13:17       ` Jani Nikula
2021-09-13 14:44 ` [Intel-gfx] [PATCH 06/16] drm/i915: Introduce with_intel_display_power_if_enabled() Ville Syrjala
2021-09-15 13:22   ` Jani Nikula
2021-09-13 14:44 ` [Intel-gfx] [PATCH 07/16] drm/i915: Adjust intel_dsc_power_domain() calling convention Ville Syrjala
2021-09-15 10:19   ` Jani Nikula
2021-09-13 14:44 ` [Intel-gfx] [PATCH 08/16] drm/i915: Extract hsw_panel_transcoders() Ville Syrjala
2021-09-15 10:20   ` Jani Nikula
2021-09-13 14:44 ` [Intel-gfx] [PATCH 09/16] drm/i915: Pimp HSW+ transcoder state readout Ville Syrjala
2021-09-21 11:46   ` Navare, Manasi
2021-09-13 14:44 ` [Intel-gfx] [PATCH 10/16] drm/i915: Configure TRANSCONF just the once with bigjoiner Ville Syrjala
2021-09-21 11:51   ` Navare, Manasi
2021-09-13 14:44 ` [Intel-gfx] [PATCH 11/16] drm/i915: Introduce intel_master_crtc() Ville Syrjala
2021-09-15 10:24   ` Jani Nikula
2021-09-15 12:21     ` Ville Syrjälä
2021-10-21 23:27   ` Navare, Manasi
2021-09-13 14:44 ` [Intel-gfx] [PATCH 12/16] drm/i915: Simplify intel_crtc_copy_uapi_to_hw_state_nomodeset() Ville Syrjala
2021-09-27 11:27   ` Navare, Manasi
2021-09-13 14:44 ` [Intel-gfx] [PATCH 13/16] drm/i915: Split PPS write from DSC enable Ville Syrjala
2021-09-27 12:01   ` Navare, Manasi
2021-09-13 14:44 ` [Intel-gfx] [PATCH 14/16] drm/i915: Perform correct cpu_transcoder readout for bigjoiner Ville Syrjala
2021-10-20 20:35   ` Navare, Manasi
2021-09-13 14:44 ` [Intel-gfx] [PATCH 15/16] drm/i915: Reduce bigjoiner special casing Ville Syrjala
2021-10-20 23:52   ` Navare, Manasi [this message]
2021-09-13 14:44 ` [Intel-gfx] [PATCH 16/16] drm/i915: Nuke PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE Ville Syrjala
2021-10-20 23:53   ` Navare, Manasi
2021-09-13 16:05 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix bigjoiner state readout Patchwork
2021-09-13 16:34 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-09-13 18:39 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=20211020235252.GA26429@labuser-Z97X-UD5H \
    --to=manasi.d.navare@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.