All of 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, intel-xe@lists.freedesktop.org,
	suraj.kandpal@intel.com
Subject: Re: [PATCH 05/15] drm/i915/dp: Add helper to compute num pipes required
Date: Thu, 19 Sep 2024 18:12:26 +0300	[thread overview]
Message-ID: <Zuw_WgxPU_BrhAmZ@intel.com> (raw)
In-Reply-To: <20240918144343.2876184-6-ankit.k.nautiyal@intel.com>

On Wed, Sep 18, 2024 at 08:13:33PM +0530, Ankit Nautiyal wrote:
> Add a helper to compute the number of pipes required.
> This will depend on whether the joiner is required or is forced through
> the debugfs. If no joiner is required the helper returns 1.
> 
> v2:
> -Return 1 if no joiner is required. (Ville)
> -Change the suffix from joined_pipes to num_pipes. (Ville)
> -Use number of pipes while calculating joined_pipe masks and
> max_dotclk. (Ville)
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c     | 51 +++++++++++++--------
>  drivers/gpu/drm/i915/display/intel_dp.h     |  6 +--
>  drivers/gpu/drm/i915/display/intel_dp_mst.c | 23 ++++------
>  3 files changed, 44 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 2e35a81fa6d1..96ad048b68cf 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -1270,17 +1270,35 @@ intel_dp_mode_valid_downstream(struct intel_connector *connector,
>  	return MODE_OK;
>  }
>  
> -bool intel_dp_need_joiner(struct intel_dp *intel_dp,
> -			  struct intel_connector *connector,
> -			  int hdisplay, int clock)
> +static
> +bool intel_dp_needs_bigjoiner(struct intel_dp *intel_dp,
> +			      struct intel_connector *connector,
> +			      int hdisplay, int clock)
>  {
>  	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>  
>  	if (!intel_dp_has_joiner(intel_dp))
>  		return false;
>  
> -	return clock > i915->display.cdclk.max_dotclk_freq || hdisplay > 5120 ||
> -	       connector->force_joined_pipes == 2;
> +	return clock > i915->display.cdclk.max_dotclk_freq || hdisplay > 5120;
> +}
> +
> +int intel_dp_compute_num_pipes(struct intel_dp *intel_dp,
> +			       struct intel_connector *connector,
> +			       int hdisplay, int clock)

intel_dp_compute_num_joined_pipes() to be a bit more specfic?
Or even just intel_dp_num_joined_pipes()?

> +{
> +	switch (connector->force_joined_pipes) {
> +	case 2:
> +		return connector->force_joined_pipes;
> +	default:
> +		MISSING_CASE(connector->force_joined_pipes);
> +		fallthrough;
> +	case 0:
> +		if (intel_dp_needs_bigjoiner(intel_dp, connector, hdisplay, clock))
> +			return 2;
> +	}
> +
> +	return 1;

I think that could be simplified to just:
{
	if (force_joined_pipes)
		return force_joined_pipes;
	
	if (need_bigjoiner())
		return 2;
	
	return 1;
}

Apart from that this looks good.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  }
>  
>  bool intel_dp_has_dsc(const struct intel_connector *connector)
> @@ -1317,7 +1335,7 @@ intel_dp_mode_valid(struct drm_connector *_connector,
>  	u16 dsc_max_compressed_bpp = 0;
>  	u8 dsc_slice_count = 0;
>  	enum drm_mode_status status;
> -	bool dsc = false, joiner = false;
> +	bool dsc = false;
>  	int num_joined_pipes;
>  
>  	status = intel_cpu_transcoder_mode_valid(dev_priv, mode);
> @@ -1339,13 +1357,9 @@ intel_dp_mode_valid(struct drm_connector *_connector,
>  		target_clock = fixed_mode->clock;
>  	}
>  
> -	if (intel_dp_need_joiner(intel_dp, connector,
> -				 mode->hdisplay, target_clock)) {
> -		joiner = true;
> -		max_dotclk *= 2;
> -	}
> -
> -	num_joined_pipes = joiner ? 2 : 1;
> +	num_joined_pipes = intel_dp_compute_num_pipes(intel_dp, connector,
> +						      mode->hdisplay, target_clock);
> +	max_dotclk *= num_joined_pipes;
>  
>  	if (target_clock > max_dotclk)
>  		return MODE_CLOCK_HIGH;
> @@ -2552,12 +2566,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
>  	    !intel_dp_supports_fec(intel_dp, connector, pipe_config))
>  		return -EINVAL;
>  
> -	if (intel_dp_need_joiner(intel_dp, connector,
> -				 adjusted_mode->crtc_hdisplay,
> -				 adjusted_mode->crtc_clock))
> -		pipe_config->joiner_pipes = GENMASK(crtc->pipe + 1, crtc->pipe);
> -
> -	num_joined_pipes = intel_crtc_num_joined_pipes(pipe_config);
> +	num_joined_pipes = intel_dp_compute_num_pipes(intel_dp, connector,
> +						      adjusted_mode->crtc_hdisplay,
> +						      adjusted_mode->crtc_clock);
> +	if (num_joined_pipes > 1)
> +		pipe_config->joiner_pipes = GENMASK(crtc->pipe + num_joined_pipes - 1, crtc->pipe);
>  
>  	joiner_needs_dsc = intel_dp_joiner_needs_dsc(i915, num_joined_pipes);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h
> index a0a31fb64716..d72ca99e3a1c 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.h
> +++ b/drivers/gpu/drm/i915/display/intel_dp.h
> @@ -154,9 +154,9 @@ int intel_dp_dsc_sink_max_compressed_bpp(const struct intel_connector *connector
>  u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
>  				int mode_clock, int mode_hdisplay,
>  				int num_joined_pipes);
> -bool intel_dp_need_joiner(struct intel_dp *intel_dp,
> -			  struct intel_connector *connector,
> -			  int hdisplay, int clock);
> +int intel_dp_compute_num_pipes(struct intel_dp *intel_dp,
> +			       struct intel_connector *connector,
> +			       int hdisplay, int clock);
>  
>  static inline unsigned int intel_dp_unused_lane_mask(int lane_count)
>  {
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> index 7debefd4a0d6..df380f6ee76c 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> @@ -580,12 +580,11 @@ static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
>  	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)
>  		return -EINVAL;
>  
> -	if (intel_dp_need_joiner(intel_dp, connector,
> -				 adjusted_mode->crtc_hdisplay,
> -				 adjusted_mode->crtc_clock))
> -		pipe_config->joiner_pipes = GENMASK(crtc->pipe + 1, crtc->pipe);
> -
> -	num_joined_pipes = intel_crtc_num_joined_pipes(pipe_config);
> +	num_joined_pipes = intel_dp_compute_num_pipes(intel_dp, connector,
> +						      adjusted_mode->crtc_hdisplay,
> +						      adjusted_mode->crtc_clock);
> +	if (num_joined_pipes > 1)
> +		pipe_config->joiner_pipes = GENMASK(crtc->pipe + num_joined_pipes - 1, crtc->pipe);
>  
>  	pipe_config->sink_format = INTEL_OUTPUT_FORMAT_RGB;
>  	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
> @@ -1427,7 +1426,7 @@ intel_dp_mst_mode_valid_ctx(struct drm_connector *connector,
>  	int max_dotclk = to_i915(connector->dev)->display.cdclk.max_dotclk_freq;
>  	int max_rate, mode_rate, max_lanes, max_link_clock;
>  	int ret;
> -	bool dsc = false, joiner = false;
> +	bool dsc = false;
>  	u16 dsc_max_compressed_bpp = 0;
>  	u8 dsc_slice_count = 0;
>  	int target_clock = mode->clock;
> @@ -1471,13 +1470,9 @@ intel_dp_mst_mode_valid_ctx(struct drm_connector *connector,
>  	 *   corresponding link capabilities of the sink) in case the
>  	 *   stream is uncompressed for it by the last branch device.
>  	 */
> -	if (intel_dp_need_joiner(intel_dp, intel_connector,
> -				 mode->hdisplay, target_clock)) {
> -		joiner = true;
> -		max_dotclk *= 2;
> -	}
> -
> -	num_joined_pipes = joiner ? 2 : 1;
> +	num_joined_pipes = intel_dp_compute_num_pipes(intel_dp, intel_connector,
> +						      mode->hdisplay, target_clock);
> +	max_dotclk *= num_joined_pipes;
>  
>  	ret = drm_modeset_lock(&mgr->base.lock, ctx);
>  	if (ret)
> -- 
> 2.45.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-09-19 15:12 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18 14:43 [PATCH 00/15] Ultrajoiner basic functionality series Ankit Nautiyal
2024-09-18 14:43 ` [PATCH 01/15] drm/i915: Add some essential functionality for joiners Ankit Nautiyal
2024-09-18 14:43 ` [PATCH 02/15] drm/i915/display: Enhance iterators for modeset en/disable Ankit Nautiyal
2024-09-18 14:43 ` [PATCH 03/15] drm/i915/display_debugfs: Allow force joiner only if supported Ankit Nautiyal
2024-09-19 15:04   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 04/15] drm/i915/display: Modify debugfs for joiner to force n pipes Ankit Nautiyal
2024-09-19 15:07   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 05/15] drm/i915/dp: Add helper to compute num pipes required Ankit Nautiyal
2024-09-19 15:12   ` Ville Syrjälä [this message]
2024-09-18 14:43 ` [PATCH 06/15] drm/i915/display: Add debugfs support to avoid joiner Ankit Nautiyal
2024-09-19 15:15   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 07/15] drm/i915: Split current joiner hw state readout Ankit Nautiyal
2024-09-19 15:18   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 08/15] drm/i915: Add bigjoiner and uncompressed joiner hw readout sanity checks Ankit Nautiyal
2024-09-19 15:22   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 09/15] drm/i915/display: Add macro HAS_ULTRAJOINER() Ankit Nautiyal
2024-09-19 15:24   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 10/15] drm/i915: Implement hw state readout and checks for ultrajoiner Ankit Nautiyal
2024-09-19 15:33   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 11/15] drm/i915/display: Refactor enable_joiner_pipes Ankit Nautiyal
2024-09-19 18:02   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 12/15] drm/i915/display/vdsc: Add ultrajoiner support with DSC Ankit Nautiyal
2024-09-19 18:06   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 13/15] drm/i915: Compute config and mode valid changes for ultrajoiner Ankit Nautiyal
2024-09-19 18:30   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 14/15] drm/i915/display: Consider ultrajoiner for computing maxdotclock Ankit Nautiyal
2024-09-19 18:42   ` Ville Syrjälä
2024-09-18 14:43 ` [PATCH 15/15] drm/i915/intel_dp: Add support for forcing ultrajoiner Ankit Nautiyal
2024-09-19 18:45   ` Ville Syrjälä
2024-09-18 15:22 ` ✗ Fi.CI.CHECKPATCH: warning for Ultrajoiner basic functionality series (rev9) Patchwork
2024-09-18 15:22 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-09-18 15:30 ` ✓ Fi.CI.BAT: success " Patchwork
2024-09-18 16:28 ` ✓ CI.Patch_applied: success for Ultrajoiner basic functionality series Patchwork
2024-09-18 16:29 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-18 16:30 ` ✓ CI.KUnit: success " Patchwork
2024-09-18 16:42 ` ✓ CI.Build: " Patchwork
2024-09-18 16:44 ` ✓ CI.Hooks: " Patchwork
2024-09-18 16:46 ` ✗ CI.checksparse: warning " Patchwork
2024-09-18 17:10 ` ✓ CI.BAT: success " Patchwork
2024-09-19  1:52 ` ✗ CI.FULL: failure " Patchwork
2024-09-19  5:01 ` ✗ Fi.CI.IGT: failure for Ultrajoiner basic functionality series (rev9) 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=Zuw_WgxPU_BrhAmZ@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --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 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.