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, intel-xe@lists.freedesktop.org,
	suraj.kandpal@intel.com
Subject: Re: [PATCH 13/15] drm/i915: Compute config and mode valid changes for ultrajoiner
Date: Thu, 19 Sep 2024 21:30:09 +0300	[thread overview]
Message-ID: <ZuxtsRz00qagilSw@intel.com> (raw)
In-Reply-To: <20240918144343.2876184-14-ankit.k.nautiyal@intel.com>

On Wed, Sep 18, 2024 at 08:13:41PM +0530, Ankit Nautiyal wrote:
> From: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> 
> Implement required changes for mode validation and compute config,
> to support Ultrajoiner.
> 
> v2:
> -Drop changes for HDMI.
> -Separate out DSC changes into another patch.
> v3: Fix check in can_ultrajoiner. (Ankit)
> 
> 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_dp.c | 44 +++++++++++++++++++++----
>  1 file changed, 37 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 369829ea5a12..4005700ab043 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -871,24 +871,34 @@ u32 get_max_compressed_bpp_with_joiner(struct drm_i915_private *i915,
>  				       int num_joined_pipes)
>  {
>  	u32 max_bpp_small_joiner_ram;
> +	u32 max_bpp_joiner;
>  
>  	/* Small Joiner Check: output bpp <= joiner RAM (bits) / Horiz. width */
>  	max_bpp_small_joiner_ram = small_joiner_ram_size_bits(i915) / mode_hdisplay;
> +	max_bpp_joiner = max_bpp_small_joiner_ram;
>  
> -	if (num_joined_pipes == 2) {
> -		int bigjoiner_interface_bits = DISPLAY_VER(i915) >= 14 ? 36 : 24;
> +	/* if ultra joiner is enabled, we have 2 bigjoiners enabled */
> +	if (num_joined_pipes == 2 ||
> +	    num_joined_pipes == 4) {

I guess just 'num_joined_pipes > 1' or something could be
used for all cases like this.

> +		int joiner_interface_bits = DISPLAY_VER(i915) >= 14 ? 36 : 24;

Isn't this specifically about bigjoiner? If so the name should stay as
is.

>  		/* With bigjoiner multiple dsc engines are used in parallel so PPC is 2 */
>  		int ppc = 2;
> -		u32 max_bpp_bigjoiner =
> -			i915->display.cdclk.max_cdclk_freq * ppc * bigjoiner_interface_bits /
> +		max_bpp_joiner =
> +			i915->display.cdclk.max_cdclk_freq * ppc * joiner_interface_bits /
>  			intel_dp_mode_to_fec_clock(mode_clock);
>  
>  		max_bpp_small_joiner_ram *= 2;

Can't we just multiply both max_* with num_joined_pipes
to take care of both bigjoiner and ultrajoiner?

>  
> -		return min(max_bpp_small_joiner_ram, max_bpp_bigjoiner);
>  	}
> +	if (num_joined_pipes == 4) {
> +		/* TODO: Check for ultrajoiner ram constraints */
>  
> -	return max_bpp_small_joiner_ram;
> +		/* both get multiplied by 2, because ram bits/ppc now doubled */
> +		max_bpp_small_joiner_ram *= 2;
> +		max_bpp_joiner *= 2;
> +	}
> +
> +	return min(max_bpp_small_joiner_ram, max_bpp_joiner);
>  }
>  
>  u16 intel_dp_dsc_get_max_compressed_bpp(struct drm_i915_private *i915,
> @@ -994,6 +1004,10 @@ u8 intel_dp_dsc_get_slice_count(const struct intel_connector *connector,
>  		if (num_joined_pipes == 2 && test_slice_count < 4)
>  			continue;
>  
> +		/* ultrajoiner needs 2 bigjoiners to be enabled */
> +		if (num_joined_pipes == 4 && test_slice_count < 8)
> +			continue;
> +
>  		if (min_slice_count <= test_slice_count)
>  			return test_slice_count;
>  	}
> @@ -1270,6 +1284,18 @@ intel_dp_mode_valid_downstream(struct intel_connector *connector,
>  	return MODE_OK;
>  }
>  
> +static
> +bool intel_dp_needs_ultrajoiner(struct intel_dp *dp, int clock)
> +{
> +	const struct intel_encoder *encoder = &dp_to_dig_port(dp)->base;
> +	struct drm_i915_private *i915 = to_i915(encoder->base.dev);

struct intel_display *display = intel_display(intel_dp);

> +
> +	if (!HAS_ULTRAJOINER(i915))
> +		return false;
> +
> +	return clock > (i915->display.cdclk.max_dotclk_freq * 2);

Redundant parens.

> +}
> +
>  static
>  bool intel_dp_needs_bigjoiner(struct intel_dp *intel_dp,
>  			      struct intel_connector *connector,
> @@ -1296,6 +1322,8 @@ int intel_dp_compute_num_pipes(struct intel_dp *intel_dp,
>  		MISSING_CASE(connector->force_joined_pipes);
>  		fallthrough;
>  	case 0:
> +		if (intel_dp_needs_ultrajoiner(intel_dp, clock))

Hmm. Technically we should be checking the same things for both
bigjoiner and ultrajoiner.

How about something like this with parametrized number 
of pipes:

bool intel_dp_needs_joiner(struct intel_dp *intel_dp,
                           struct intel_connector *connector,
                           int hdisplay, int clock,
                           int num_joined_pipes)
{
        if (!intel_dp_has_joiner(intel_dp))
                return false;

        num_joined_pipes /= 2;

        return clock > num_joined_pipes * max_dotclk_freq ||
                hdisplay > num_joined_pipes * 5120;
}

Pair that with HAS_*JOINER(), and pass in the correct number
of joined pipes to get final answer.


> +			return 4;
>  		if (intel_dp_needs_bigjoiner(intel_dp, connector, hdisplay, clock))
>  			return 2;
>  	}
> @@ -2542,8 +2570,10 @@ bool intel_dp_joiner_needs_dsc(struct drm_i915_private *i915,
>  	 * Pipe joiner needs compression up to display 12 due to bandwidth
>  	 * limitation. DG2 onwards pipe joiner can be enabled without
>  	 * compression.
> +	 * Ultrajoiner always needs compression.
>  	 */
> -	return !HAS_UNCOMPRESSED_JOINER(i915) && num_joined_pipes == 2;
> +	return (!HAS_UNCOMPRESSED_JOINER(i915) && num_joined_pipes == 2) ||
> +		num_joined_pipes == 4;
>  }
>  
>  static int
> -- 
> 2.45.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2024-09-19 18:30 UTC|newest]

Thread overview: 34+ 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ä
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ä [this message]
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-19  5:01 ` ✗ Fi.CI.IGT: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-09-26  7:26 [PATCH 00/15] Ultrajoiner basic functionality series Ankit Nautiyal
2024-09-26  7:26 ` [PATCH 13/15] drm/i915: Compute config and mode valid changes for ultrajoiner Ankit Nautiyal

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=ZuxtsRz00qagilSw@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox