Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: intel-gfx@lists.freedesktop.org, suraj.kandpal@intel.com,
	jani.saarinen@intel.com
Subject: Re: [PATCH 14/19] drm/i915/display: Percolate ultrajoiner info to get_joiner_config
Date: Wed, 11 Sep 2024 23:45:50 +0300	[thread overview]
Message-ID: <ZuIBfkP4QcHTCHRh@intel.com> (raw)
In-Reply-To: <20240911131349.933814-15-ankit.k.nautiyal@intel.com>

On Wed, Sep 11, 2024 at 06:43:44PM +0530, Ankit Nautiyal wrote:
> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> 
> Modify the helpers get_primary/secondary_pipes to account for
> ultrajoiner usage. Use the modified helpers to retrieve ultrajoiner
> information in get_joiner_config.
> 
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 57 +++++++++++++-------
>  1 file changed, 37 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 02926a8ef7c5..24698d8ed5d6 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -3716,7 +3716,8 @@ static void enabled_ultrajoiner_pipes(struct drm_i915_private *i915,
>  }
>  
>  static void enabled_joiner_pipes(struct drm_i915_private *dev_priv,
> -				 u8 *primary_pipes, u8 *secondary_pipes)
> +				 u8 *primary_pipes, u8 *secondary_pipes,
> +				 bool *ultrajoiner_used)

I think life will be simpler if we just pass the current pipe into
enabled_joiner_pipes(), and let it figure out the proper bitmasks
for us.

We should be able to just do somehting like:

if (ultrajoiner_pipes & BIT(pipe)) {
	*primary_pipes = BIT(get_primary_pipe(ultrajoiner_primary_pipes, pipe));
	*secondary_pipes = ultrajoiner_secondary_pipes &
                       expected_ultrajoiner_secondary_pipes(*primary_pipes);
	return;
}
// same for uncompressed joiner
// same for bigjoiner

to get the approriate primary pipe and secondary pipes for the current
pipe.

>  {
>  	struct intel_display *display = to_intel_display(&dev_priv->drm);
>  	u8 primary_uncompressed_joiner_pipes, primary_bigjoiner_pipes;
> @@ -3760,6 +3761,7 @@ static void enabled_joiner_pipes(struct drm_i915_private *dev_priv,
>  				    secondary_uncompressed_joiner_pipes;
>  	bigjoiner_pipes = primary_bigjoiner_pipes | secondary_bigjoiner_pipes;
>  	ultrajoiner_pipes = primary_ultrajoiner_pipes | secondary_ultrajoiner_pipes;
> +	*ultrajoiner_used = ultrajoiner_pipes != 0;
>  
>  	drm_WARN(display->drm, (uncompressed_joiner_pipes & bigjoiner_pipes) != 0,
>  		 "Uncomressed joiner pipes(%#x) and bigjoiner pipes(%#x) can't intersect\n",
> @@ -3794,7 +3796,8 @@ static void enabled_joiner_pipes(struct drm_i915_private *dev_priv,
>  		 *primary_pipes, *secondary_pipes);
>  }
>  
> -static enum pipe get_joiner_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes)
> +static enum pipe get_joiner_primary_pipe(enum pipe pipe, u8 primary_pipes,
> +					 u8 secondary_pipes, bool ultrajoiner_used)
>  {
>  	if ((secondary_pipes & BIT(pipe)) == 0)
>  		return pipe;
> @@ -3802,27 +3805,37 @@ static enum pipe get_joiner_primary_pipe(enum pipe pipe, u8 primary_pipes, u8 se
>  	/* ignore everything above our pipe */
>  	primary_pipes &= ~GENMASK(7, pipe);
>  
> -	/* highest remaining bit should be our primary pipe */
> -	return fls(primary_pipes) - 1;
> +	if (!ultrajoiner_used)
> +		/* highest remaining bit should be our master pipe */
> +		return fls(primary_pipes) - 1;
> +
> +	/* lowest remaining bit should be our primary master pipe */
> +	return ffs(primary_pipes) - 1;
>  }
>  
> -static u8 get_joiner_secondary_pipes(enum pipe pipe, u8 primary_pipes, u8 secondary_pipes)
> +static u8 get_joiner_secondary_pipes(enum pipe pipe, u8 primary_pipes,
> +				     u8 secondary_pipes, bool ultrajoiner_used)
>  {
>  	enum pipe primary_pipe, next_primary_pipe;
>  
> -	primary_pipe = get_joiner_primary_pipe(pipe, primary_pipes, secondary_pipes);
> +	primary_pipe = get_joiner_primary_pipe(pipe, primary_pipes,
> +					       secondary_pipes, ultrajoiner_used);
>  
>  	if ((primary_pipes & BIT(primary_pipe)) == 0)
>  		return 0;
>  
> -	/* ignore our primary pipe and everything below it */
> -	primary_pipes &= ~GENMASK(primary_pipe, 0);
> -	/* make sure a high bit is set for the ffs() */
> -	primary_pipes |= BIT(7);
> -	/* lowest remaining bit should be the next primary pipe */
> -	next_primary_pipe = ffs(primary_pipes) - 1;
> +	if (!ultrajoiner_used) {
> +		/* ignore our primary pipe and everything below it */
> +		primary_pipes &= ~GENMASK(primary_pipe, 0);
> +		/* make sure a high bit is set for the ffs() */
> +		primary_pipes |= BIT(7);
> +		/* lowest remaining bit should be the next primary pipe */
> +		next_primary_pipe = ffs(primary_pipes) - 1;
>  
> -	return secondary_pipes & GENMASK(next_primary_pipe - 1, primary_pipe);
> +		return secondary_pipes & GENMASK(next_primary_pipe - 1, primary_pipe);
> +	} else {
> +		return (secondary_pipes | primary_pipes) & ~BIT(primary_pipe);
> +	}
>  }
>  
>  static u8 hsw_panel_transcoders(struct drm_i915_private *i915)
> @@ -3843,6 +3856,7 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
>  	enum transcoder cpu_transcoder;
>  	u8 primary_pipes, secondary_pipes;
>  	u8 enabled_transcoders = 0;
> +	bool ultrajoiner_used;
>  
>  	/*
>  	 * XXX: Do intel_display_power_get_if_enabled before reading this (for
> @@ -3893,11 +3907,12 @@ static u8 hsw_enabled_transcoders(struct intel_crtc *crtc)
>  	if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
>  		enabled_transcoders |= BIT(cpu_transcoder);
>  
> -	/* joiner secondary -> consider the primary pipe's transcoder as well */
> -	enabled_joiner_pipes(dev_priv, &primary_pipes, &secondary_pipes);
> +	/* joiner slave -> consider the master pipe's transcoder as well */
> +	enabled_joiner_pipes(dev_priv, &primary_pipes, &secondary_pipes, &ultrajoiner_used);
>  	if (secondary_pipes & BIT(crtc->pipe)) {
>  		cpu_transcoder = (enum transcoder)
> -			get_joiner_primary_pipe(crtc->pipe, primary_pipes, secondary_pipes);
> +			get_joiner_primary_pipe(crtc->pipe, primary_pipes,
> +						secondary_pipes, ultrajoiner_used);
>  		if (transcoder_ddi_func_is_enabled(dev_priv, cpu_transcoder))
>  			enabled_transcoders |= BIT(cpu_transcoder);
>  	}
> @@ -4029,16 +4044,18 @@ static void intel_joiner_get_config(struct intel_crtc_state *crtc_state)
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  	struct drm_i915_private *i915 = to_i915(crtc->base.dev);
>  	u8 primary_pipes, secondary_pipes;
> +	bool ultrajoiner_used;
>  	enum pipe pipe = crtc->pipe;
>  
> -	enabled_joiner_pipes(i915, &primary_pipes, &secondary_pipes);
> +	enabled_joiner_pipes(i915, &primary_pipes, &secondary_pipes, &ultrajoiner_used);
>  
>  	if (((primary_pipes | secondary_pipes) & BIT(pipe)) == 0)
>  		return;
>  
> -	crtc_state->joiner_pipes =
> -		BIT(get_joiner_primary_pipe(pipe, primary_pipes, secondary_pipes)) |
> -		get_joiner_secondary_pipes(pipe, primary_pipes, secondary_pipes);
> +	crtc_state->joiner_pipes = BIT(get_joiner_primary_pipe(pipe, primary_pipes,
> +							       secondary_pipes, ultrajoiner_used)) |
> +				   get_joiner_secondary_pipes(pipe, primary_pipes,
> +							      secondary_pipes, ultrajoiner_used);
>  }
>  
>  static bool hsw_get_pipe_config(struct intel_crtc *crtc,
> -- 
> 2.45.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-09-11 20:45 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11 13:13 [PATCH 00/19] Ultrajoiner basic functionality series Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 01/19] drm/i915/display: Check whether platform supports joiner Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 02/19] drm/i915/display: Modify debugfs for joiner to force n pipes Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 03/19] drm/i915/display_debugfs: Allow force joiner only if supported Ankit Nautiyal
2024-09-11 20:00   ` Ville Syrjälä
2024-09-11 20:11   ` Ville Syrjälä
2024-09-11 13:13 ` [PATCH 04/19] drm/i915/dp: Add helper to compute num pipes joined Ankit Nautiyal
2024-09-11 20:10   ` Ville Syrjälä
2024-09-11 13:13 ` [PATCH 05/19] drm/i915/display: Add debugfs support to avoid joiner Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 06/19] drm/i915/display: Simplify intel_joiner_num_pipes and its usage Ankit Nautiyal
2024-09-11 20:14   ` Ville Syrjälä
2024-09-12 10:15     ` Nautiyal, Ankit K
2024-09-11 13:13 ` [PATCH 07/19] drm/i915/display: Use joined pipes in intel_dp_joiner_needs_dsc Ankit Nautiyal
2024-09-11 20:17   ` Ville Syrjälä
2024-09-12 10:20     ` Nautiyal, Ankit K
2024-09-12 10:58       ` Ville Syrjälä
2024-09-12 11:04         ` Nautiyal, Ankit K
2024-09-11 13:13 ` [PATCH 08/19] drm/i915/display: Use joined pipes in intel_mode_valid_max_plane_size Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 09/19] drm/i915/display: Use joined pipes in dsc helpers for slices, bpp Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 10/19] drm/i915: Add some essential functionality for joiners Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 11/19] drm/i915: Split current joiner hw state readout Ankit Nautiyal
2024-09-11 20:28   ` Ville Syrjälä
2024-09-11 13:13 ` [PATCH 12/19] drm/i915: Add bigjoiner and uncompressed joiner hw readout sanity checks Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 13/19] drm/i915: Implement hw state readout and checks for ultrajoiner Ankit Nautiyal
2024-09-11 20:33   ` Ville Syrjälä
2024-09-11 13:13 ` [PATCH 14/19] drm/i915/display: Percolate ultrajoiner info to get_joiner_config Ankit Nautiyal
2024-09-11 20:45   ` Ville Syrjälä [this message]
2024-09-11 13:13 ` [PATCH 15/19] drm/i915/display/vdsc: Add ultrajoiner support with DSC Ankit Nautiyal
2024-09-11 20:48   ` Ville Syrjälä
2024-09-11 13:13 ` [PATCH 16/19] drm/i915: Add new abstraction layer to handle pipe order for different joiners Ankit Nautiyal
2024-09-11 22:38   ` Ville Syrjälä
2024-09-16  7:39     ` Nautiyal, Ankit K
2024-09-16 14:54       ` Ville Syrjälä
2024-09-16 15:06         ` Ville Syrjälä
2024-09-17  9:22           ` Nautiyal, Ankit K
2024-09-17 12:14             ` Ville Syrjälä
2024-09-11 13:13 ` [PATCH 17/19] drm/i915: Compute config and mode valid changes for ultrajoiner Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 18/19] drm/i915/display: Consider ultrajoiner for computing maxdotclock Ankit Nautiyal
2024-09-11 13:13 ` [PATCH 19/19] drm/i915/intel_dp: Add support for forcing ultrajoiner Ankit Nautiyal
2024-09-11 19:29 ` ✗ Fi.CI.BUILD: failure for Ultrajoiner basic functionality series (rev8) Patchwork
2024-09-11 23:05 ` [PATCH 00/19] Ultrajoiner basic functionality series Ville Syrjälä
2024-09-12 11:02   ` 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=ZuIBfkP4QcHTCHRh@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.saarinen@intel.com \
    --cc=suraj.kandpal@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