Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 10/12] drm/i915: Eliminate bigjoiner boolean
Date: Wed, 16 Feb 2022 16:27:49 +0530	[thread overview]
Message-ID: <b713032b-2696-677f-d1a6-b3eece58b678@intel.com> (raw)
In-Reply-To: <20220215183208.6143-11-ville.syrjala@linux.intel.com>


On 2/16/2022 12:02 AM, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Since we now have the bigjoiner_pipes bitmask the boolean
> is redundant. Get rid of it.
>
> Also, populating bigjoiner_pipes already during
> encoder->compute_config() allows us to use it much earlier
> during the state calculation as well. The initial aim is
> to use it in intel_crtc_compute_config().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_cursor.c   |  2 +-
>   drivers/gpu/drm/i915/display/intel_display.c  | 50 ++++++++-----------
>   .../drm/i915/display/intel_display_debugfs.c  |  2 +-
>   .../drm/i915/display/intel_display_types.h    |  3 --
>   drivers/gpu/drm/i915/display/intel_dp.c       | 13 ++---
>   drivers/gpu/drm/i915/display/intel_vdsc.c     |  8 +--
>   .../drm/i915/display/skl_universal_plane.c    |  2 +-
>   7 files changed, 36 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_cursor.c b/drivers/gpu/drm/i915/display/intel_cursor.c
> index 1f448f4e9aaf..da6cf0515164 100644
> --- a/drivers/gpu/drm/i915/display/intel_cursor.c
> +++ b/drivers/gpu/drm/i915/display/intel_cursor.c
> @@ -640,7 +640,7 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
>   	 * FIXME bigjoiner fastpath would be good
>   	 */
>   	if (!crtc_state->hw.active || intel_crtc_needs_modeset(crtc_state) ||
> -	    crtc_state->update_pipe || crtc_state->bigjoiner)
> +	    crtc_state->update_pipe || crtc_state->bigjoiner_pipes)
>   		goto slow;
>   
>   	/*
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 47b5d8cc16fd..192474163edb 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -1926,7 +1926,7 @@ static void hsw_crtc_enable(struct intel_atomic_state *state,
>   	if (drm_WARN_ON(&dev_priv->drm, crtc->active))
>   		return;
>   
> -	if (!new_crtc_state->bigjoiner) {
> +	if (!new_crtc_state->bigjoiner_pipes) {
>   		intel_encoders_pre_pll_enable(state, crtc);
>   
>   		if (new_crtc_state->shared_dpll)
> @@ -2727,7 +2727,7 @@ static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state)
>   static void intel_bigjoiner_adjust_timings(const struct intel_crtc_state *crtc_state,
>   					   struct drm_display_mode *mode)
>   {
> -	if (!crtc_state->bigjoiner)
> +	if (!crtc_state->bigjoiner_pipes)
>   		return;
>   
>   	mode->crtc_clock /= 2;
> @@ -2811,7 +2811,7 @@ static void intel_bigjoiner_compute_pipe_src(struct intel_crtc_state *crtc_state
>   {
>   	int width, height;
>   
> -	if (!crtc_state->bigjoiner)
> +	if (!crtc_state->bigjoiner_pipes)
>   		return;
>   
>   	width = drm_rect_width(&crtc_state->pipe_src);
> @@ -4218,7 +4218,6 @@ static void intel_bigjoiner_get_config(struct intel_crtc_state *crtc_state)
>   	if (((master_pipes | slave_pipes) & BIT(pipe)) == 0)
>   		return;
>   
> -	crtc_state->bigjoiner = true;
>   	crtc_state->bigjoiner_pipes =
>   		BIT(get_bigjoiner_master_pipe(pipe, master_pipes, slave_pipes)) |
>   		get_bigjoiner_slave_pipes(pipe, master_pipes, slave_pipes);

Although not part of this patch, do we need to check if 
get_bigjoiner_master_pipe() does not give PIPE_INVALID?

Perhaps in a case where master_pipe is read as 0 but some garbage for 
slave_pipes during readout?

Should there be a check for INVALID_PIPE, before feeding into BIT() macro?

Otherwise patch looks good to me.

Regards,

Ankit

> @@ -5804,6 +5803,9 @@ copy_bigjoiner_crtc_state_modeset(struct intel_atomic_state *state,
>   		intel_atomic_get_new_crtc_state(state, master_crtc);
>   	struct intel_crtc_state *saved_state;
>   
> +	WARN_ON(master_crtc_state->bigjoiner_pipes !=
> +		slave_crtc_state->bigjoiner_pipes);
> +
>   	saved_state = kmemdup(master_crtc_state, sizeof(*saved_state), GFP_KERNEL);
>   	if (!saved_state)
>   		return -ENOMEM;
> @@ -5834,6 +5836,9 @@ copy_bigjoiner_crtc_state_modeset(struct intel_atomic_state *state,
>   	slave_crtc_state->uapi.connectors_changed = master_crtc_state->uapi.connectors_changed;
>   	slave_crtc_state->uapi.active_changed = master_crtc_state->uapi.active_changed;
>   
> +	WARN_ON(master_crtc_state->bigjoiner_pipes !=
> +		slave_crtc_state->bigjoiner_pipes);
> +
>   	return 0;
>   }
>   
> @@ -6604,7 +6609,6 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>   
>   	PIPE_CONF_CHECK_X(sync_mode_slaves_mask);
>   	PIPE_CONF_CHECK_I(master_transcoder);
> -	PIPE_CONF_CHECK_BOOL(bigjoiner);
>   	PIPE_CONF_CHECK_X(bigjoiner_pipes);
>   
>   	PIPE_CONF_CHECK_I(dsc.compression_enable);
> @@ -7535,32 +7539,26 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
>   	struct intel_crtc_state *master_crtc_state =
>   		intel_atomic_get_new_crtc_state(state, master_crtc);
>   	struct intel_crtc *slave_crtc;
> -	u8 slave_pipes;
>   
> -	/*
> -	 * TODO: encoder.compute_config() may be the best
> -	 * place to populate the bitmask for the master crtc.
> -	 * For now encoder.compute_config() just flags things
> -	 * as needing bigjoiner and we populate the bitmask
> -	 * here.
> -	 */
> -	WARN_ON(master_crtc_state->bigjoiner_pipes);
> -
> -	if (!master_crtc_state->bigjoiner)
> +	if (!master_crtc_state->bigjoiner_pipes)
>   		return 0;
>   
> -	slave_pipes = BIT(master_crtc->pipe + 1);
> +	/* sanity check */
> +	if (drm_WARN_ON(&i915->drm,
> +			master_crtc->pipe != bigjoiner_master_pipe(master_crtc_state)))
> +		return -EINVAL;
>   
> -	if (slave_pipes & ~bigjoiner_pipes(i915)) {
> +	if (master_crtc_state->bigjoiner_pipes & ~bigjoiner_pipes(i915)) {
>   		drm_dbg_kms(&i915->drm,
>   			    "[CRTC:%d:%s] Cannot act as big joiner master "
> -			    "(need 0x%x as slave pipes, only 0x%x possible)\n",
> +			    "(need 0x%x as pipes, only 0x%x possible)\n",
>   			    master_crtc->base.base.id, master_crtc->base.name,
> -			    slave_pipes, bigjoiner_pipes(i915));
> +			    master_crtc_state->bigjoiner_pipes, bigjoiner_pipes(i915));
>   		return -EINVAL;
>   	}
>   
> -	for_each_intel_crtc_in_pipe_mask(&i915->drm, slave_crtc, slave_pipes) {
> +	for_each_intel_crtc_in_pipe_mask(&i915->drm, slave_crtc,
> +					 intel_crtc_bigjoiner_slave_pipes(master_crtc_state)) {
>   		struct intel_crtc_state *slave_crtc_state;
>   		int ret;
>   
> @@ -7594,10 +7592,8 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
>   			    slave_crtc->base.base.id, slave_crtc->base.name,
>   			    master_crtc->base.base.id, master_crtc->base.name);
>   
> -		master_crtc_state->bigjoiner_pipes =
> -			BIT(master_crtc->pipe) | BIT(slave_crtc->pipe);
>   		slave_crtc_state->bigjoiner_pipes =
> -			BIT(master_crtc->pipe) | BIT(slave_crtc->pipe);
> +			master_crtc_state->bigjoiner_pipes;
>   
>   		ret = copy_bigjoiner_crtc_state_modeset(state, slave_crtc);
>   		if (ret)
> @@ -7620,13 +7616,11 @@ static void kill_bigjoiner_slave(struct intel_atomic_state *state,
>   		struct intel_crtc_state *slave_crtc_state =
>   			intel_atomic_get_new_crtc_state(state, slave_crtc);
>   
> -		slave_crtc_state->bigjoiner = false;
>   		slave_crtc_state->bigjoiner_pipes = 0;
>   
>   		intel_crtc_copy_uapi_to_hw_state_modeset(state, slave_crtc);
>   	}
>   
> -	master_crtc_state->bigjoiner = false;
>   	master_crtc_state->bigjoiner_pipes = 0;
>   }
>   
> @@ -7936,7 +7930,7 @@ static int intel_atomic_check(struct drm_device *dev,
>   			}
>   		}
>   
> -		if (new_crtc_state->bigjoiner) {
> +		if (new_crtc_state->bigjoiner_pipes) {
>   			if (intel_pipes_need_modeset(state, new_crtc_state->bigjoiner_pipes)) {
>   				new_crtc_state->uapi.mode_changed = true;
>   				new_crtc_state->update_pipe = false;
> @@ -10338,7 +10332,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
>   			intel_encoder_get_config(encoder, crtc_state);
>   
>   			/* read out to slave crtc as well for bigjoiner */
> -			if (crtc_state->bigjoiner) {
> +			if (crtc_state->bigjoiner_pipes) {
>   				struct intel_crtc *slave_crtc;
>   
>   				/* encoder should read be linked to bigjoiner master */
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> index 475ae7e7f760..c87718ae2c46 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -935,7 +935,7 @@ static void intel_crtc_info(struct seq_file *m, struct intel_crtc *crtc)
>   		intel_scaler_info(m, crtc);
>   	}
>   
> -	if (crtc_state->bigjoiner)
> +	if (crtc_state->bigjoiner_pipes)
>   		seq_printf(m, "\tLinked to 0x%x pipes as a %s\n",
>   			   crtc_state->bigjoiner_pipes,
>   			   intel_crtc_is_bigjoiner_slave(crtc_state) ? "slave" : "master");
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index c1a291b6b638..92357fdbd0f0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1199,9 +1199,6 @@ struct intel_crtc_state {
>   	/* enable pipe csc? */
>   	bool csc_enable;
>   
> -	/* enable pipe big joiner? */
> -	bool bigjoiner;
> -
>   	/* big joiner pipe bitmask */
>   	u8 bigjoiner_pipes;
>   
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 1046e7fe310a..05e1da3c43e2 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -1424,13 +1424,13 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>   						    pipe_config->lane_count,
>   						    adjusted_mode->crtc_clock,
>   						    adjusted_mode->crtc_hdisplay,
> -						    pipe_config->bigjoiner,
> +						    pipe_config->bigjoiner_pipes,
>   						    pipe_bpp);
>   		dsc_dp_slice_count =
>   			intel_dp_dsc_get_slice_count(intel_dp,
>   						     adjusted_mode->crtc_clock,
>   						     adjusted_mode->crtc_hdisplay,
> -						     pipe_config->bigjoiner);
> +						     pipe_config->bigjoiner_pipes);
>   		if (!dsc_max_output_bpp || !dsc_dp_slice_count) {
>   			drm_dbg_kms(&dev_priv->drm,
>   				    "Compressed BPP/Slice Count not supported\n");
> @@ -1464,7 +1464,7 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
>   	 * then we need to use 2 VDSC instances.
>   	 */
>   	if (adjusted_mode->crtc_clock > dev_priv->max_cdclk_freq ||
> -	    pipe_config->bigjoiner) {
> +	    pipe_config->bigjoiner_pipes) {
>   		if (pipe_config->dsc.slice_count < 2) {
>   			drm_dbg_kms(&dev_priv->drm,
>   				    "Cannot split stream to use 2 VDSC instances\n");
> @@ -1500,6 +1500,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>   			     struct drm_connector_state *conn_state)
>   {
>   	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> +	struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc);
>   	const struct drm_display_mode *adjusted_mode =
>   		&pipe_config->hw.adjusted_mode;
>   	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> @@ -1537,7 +1538,7 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>   
>   	if (intel_dp_need_bigjoiner(intel_dp, adjusted_mode->crtc_hdisplay,
>   				    adjusted_mode->crtc_clock))
> -		pipe_config->bigjoiner = true;
> +		pipe_config->bigjoiner_pipes = GENMASK(crtc->pipe + 1, crtc->pipe);
>   
>   	/*
>   	 * Optimize for slow and wide for everything, because there are some
> @@ -1550,8 +1551,8 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>   	 * onwards pipe joiner can be enabled without compression.
>   	 */
>   	drm_dbg_kms(&i915->drm, "Force DSC en = %d\n", intel_dp->force_dsc_en);
> -	if (ret || intel_dp->force_dsc_en || (DISPLAY_VER(i915) < 13 &&
> -					      pipe_config->bigjoiner)) {
> +	if (ret || intel_dp->force_dsc_en ||
> +	    (DISPLAY_VER(i915) < 13 && pipe_config->bigjoiner_pipes)) {
>   		ret = intel_dp_dsc_compute_config(intel_dp, pipe_config,
>   						  conn_state, &limits);
>   		if (ret < 0)
> diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c
> index 545eff5bf158..28a1c982750e 100644
> --- a/drivers/gpu/drm/i915/display/intel_vdsc.c
> +++ b/drivers/gpu/drm/i915/display/intel_vdsc.c
> @@ -579,7 +579,7 @@ static void intel_dsc_pps_configure(const struct intel_crtc_state *crtc_state)
>   	u8 num_vdsc_instances = (crtc_state->dsc.dsc_split) ? 2 : 1;
>   	int i = 0;
>   
> -	if (crtc_state->bigjoiner)
> +	if (crtc_state->bigjoiner_pipes)
>   		num_vdsc_instances *= 2;
>   
>   	/* Populate PICTURE_PARAMETER_SET_0 registers */
> @@ -1113,7 +1113,7 @@ void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state)
>   	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>   	u32 dss_ctl1_val = 0;
>   
> -	if (crtc_state->bigjoiner && !crtc_state->dsc.compression_enable) {
> +	if (crtc_state->bigjoiner_pipes && !crtc_state->dsc.compression_enable) {
>   		if (intel_crtc_is_bigjoiner_slave(crtc_state))
>   			dss_ctl1_val |= UNCOMPRESSED_JOINER_SLAVE;
>   		else
> @@ -1140,7 +1140,7 @@ void intel_dsc_enable(const struct intel_crtc_state *crtc_state)
>   		dss_ctl2_val |= RIGHT_BRANCH_VDSC_ENABLE;
>   		dss_ctl1_val |= JOINER_ENABLE;
>   	}
> -	if (crtc_state->bigjoiner) {
> +	if (crtc_state->bigjoiner_pipes) {
>   		dss_ctl1_val |= BIG_JOINER_ENABLE;
>   		if (!intel_crtc_is_bigjoiner_slave(crtc_state))
>   			dss_ctl1_val |= MASTER_BIG_JOINER_ENABLE;
> @@ -1156,7 +1156,7 @@ void intel_dsc_disable(const struct intel_crtc_state *old_crtc_state)
>   
>   	/* Disable only if either of them is enabled */
>   	if (old_crtc_state->dsc.compression_enable ||
> -	    old_crtc_state->bigjoiner) {
> +	    old_crtc_state->bigjoiner_pipes) {
>   		intel_de_write(dev_priv, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0);
>   		intel_de_write(dev_priv, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0);
>   	}
> diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> index c73758d18b6f..925e0bd8bb72 100644
> --- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
> +++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
> @@ -2284,7 +2284,7 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
>   
>   	drm_WARN_ON(dev, pipe != crtc->pipe);
>   
> -	if (crtc_state->bigjoiner) {
> +	if (crtc_state->bigjoiner_pipes) {
>   		drm_dbg_kms(&dev_priv->drm,
>   			    "Unsupported bigjoiner configuration for initial FB\n");
>   		return;

  reply	other threads:[~2022-02-16 10:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 18:31 [Intel-gfx] [PATCH 00/12] drm/i915: Move bigjoiner refactoring Ville Syrjala
2022-02-15 18:31 ` [Intel-gfx] [PATCH 01/12] drm/i915: Fix cursor coordinates on bigjoiner slave Ville Syrjala
2022-02-16  3:25   ` Navare, Manasi
2022-02-16  8:39     ` Ville Syrjälä
2022-02-16 19:23       ` Navare, Manasi
2022-02-15 18:31 ` [Intel-gfx] [PATCH 02/12] drm/i915: Remove nop bigjoiner state copy Ville Syrjala
2022-02-16 12:52   ` Nautiyal, Ankit K
2022-02-15 18:31 ` [Intel-gfx] [PATCH 03/12] drm/i915: Rename variables in intel_crtc_compute_config() Ville Syrjala
2022-02-16 19:26   ` Navare, Manasi
2022-02-15 18:32 ` [Intel-gfx] [PATCH 04/12] drm/i915: Extract intel_splitter_adjust_timings() Ville Syrjala
2022-02-17  8:26   ` Jani Nikula
2022-02-15 18:32 ` [Intel-gfx] [PATCH 05/12] drm/i915: Extract intel_bigjoiner_adjust_timings() Ville Syrjala
2022-02-16 19:32   ` Navare, Manasi
2022-02-15 18:32 ` [Intel-gfx] [PATCH 06/12] drm/i915: Extract intel_crtc_compute_pipe_src() Ville Syrjala
2022-02-16 19:35   ` Navare, Manasi
2022-02-16 19:44     ` Ville Syrjälä
2022-02-15 18:32 ` [Intel-gfx] [PATCH 07/12] drm/i915: Extract intel_crtc_compute_pipe_mode() Ville Syrjala
2022-02-16 19:37   ` Navare, Manasi
2022-02-15 18:32 ` [Intel-gfx] [PATCH 08/12] drm/i915: Fix MSO vs. bigjoiner timings confusion Ville Syrjala
2022-02-16 19:50   ` Navare, Manasi
2022-02-15 18:32 ` [Intel-gfx] [PATCH 09/12] drm/i915: Start tracking PIPESRC as a drm_rect Ville Syrjala
2022-02-16 11:38   ` Ville Syrjälä
2022-02-15 18:32 ` [Intel-gfx] [PATCH 10/12] drm/i915: Eliminate bigjoiner boolean Ville Syrjala
2022-02-16 10:57   ` Nautiyal, Ankit K [this message]
2022-02-16 11:04     ` Ville Syrjälä
2022-02-16 11:23       ` Nautiyal, Ankit K
2022-02-16 21:25   ` Navare, Manasi
2022-02-15 18:32 ` [Intel-gfx] [PATCH 11/12] drm/i915: Use bigjoiner_pipes more Ville Syrjala
2022-02-16 12:27   ` Nautiyal, Ankit K
2022-02-16 12:35   ` Ville Syrjälä
2022-02-16 21:26   ` Navare, Manasi
2022-02-15 18:32 ` [Intel-gfx] [PATCH 12/12] drm/i915: Make the PIPESC rect relative to the entire bigjoiner area Ville Syrjala
2022-02-17  1:06 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Move bigjoiner refactoring Patchwork
2022-02-17 10:29   ` Ville Syrjälä
2022-02-17 10:17 ` [Intel-gfx] [PATCH 00/12] " Nautiyal, Ankit K

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=b713032b-2696-677f-d1a6-b3eece58b678@intel.com \
    --to=ankit.k.nautiyal@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox