diff mbox series

[13/17] drm/i915/dp: Modify compressed bpp limitations for ultrajoiner

Message ID 20240927152241.4014909-14-ankit.k.nautiyal@intel.com (mailing list archive)
State New, archived
Headers show
Series Ultrajoiner basic functionality series | expand

Commit Message

Nautiyal, Ankit K Sept. 27, 2024, 3:22 p.m. UTC
Add compressed bpp limitations for ultrajoiner.

v2: Fix the case for 1 pipe. (Ankit)
v3: Refactor existing helper separately and add only ultrajoiner
limitation. (Ville)
v4: Separate out function for ultrajoiner_ram_bits.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Comments

Ville Syrjälä Sept. 27, 2024, 3:55 p.m. UTC | #1
On Fri, Sep 27, 2024 at 08:52:37PM +0530, Ankit Nautiyal wrote:
> Add compressed bpp limitations for ultrajoiner.
> 
> v2: Fix the case for 1 pipe. (Ankit)
> v3: Refactor existing helper separately and add only ultrajoiner
> limitation. (Ville)
> v4: Separate out function for ultrajoiner_ram_bits.
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index a85527a55dc0..8a32d38d21bf 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -896,6 +896,16 @@ static u32 small_joiner_ram_max_bpp(struct intel_display *display,
>  	return max_bpp;
>  }
>  
> +static int ultrajoiner_ram_bits(void)
> +{
> +	return 4 * 72 * 512;
> +}
> +
> +static u32 ultrajoiner_ram_max_bpp(u32 mode_hdisplay)
> +{
> +	return ultrajoiner_ram_bits() / mode_hdisplay;
> +}
> +
>  static
>  u32 get_max_compressed_bpp_with_joiner(struct drm_i915_private *i915,
>  				       u32 mode_clock, u32 mode_hdisplay,
> @@ -907,11 +917,18 @@ u32 get_max_compressed_bpp_with_joiner(struct drm_i915_private *i915,
>  	max_bpp_small_joiner_ram = small_joiner_ram_max_bpp(display, mode_hdisplay,
>  							    num_joined_pipes);
>  
> -	if (num_joined_pipes == 2) {
> +	if (num_joined_pipes > 1) {
> +		u32 max_bpp;
>  		u32 max_bpp_bigjoiner = bigjoiner_bw_max_bpp(display, mode_clock,
>  							     num_joined_pipes);
>  
> -		return min(max_bpp_small_joiner_ram, max_bpp_bigjoiner);
> +		max_bpp = min(max_bpp_small_joiner_ram, max_bpp_bigjoiner);
> +
> +		if (num_joined_pipes == 2)
> +			return max_bpp;
> +
> +		if (num_joined_pipes == 4)
> +			return min(max_bpp, ultrajoiner_ram_max_bpp(mode_hdisplay));
>  	}

This whole thing could be simplified to just:

{
	max_bpp = small_joiner_ram_max_bpp(...);

	if (num_joined_pipes > 1)
		max_bpp = min(max_bpp, bigjoiner_bw_max_bpp(...));

	if (num_joined_pipes == 4)
		max_bpp = min(max_bpp, ultrajoiner_ram_max_bpp(...));

	return max_bpp;
}

but that can be done as a followup.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  
>  	return max_bpp_small_joiner_ram;
> -- 
> 2.45.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index a85527a55dc0..8a32d38d21bf 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -896,6 +896,16 @@  static u32 small_joiner_ram_max_bpp(struct intel_display *display,
 	return max_bpp;
 }
 
+static int ultrajoiner_ram_bits(void)
+{
+	return 4 * 72 * 512;
+}
+
+static u32 ultrajoiner_ram_max_bpp(u32 mode_hdisplay)
+{
+	return ultrajoiner_ram_bits() / mode_hdisplay;
+}
+
 static
 u32 get_max_compressed_bpp_with_joiner(struct drm_i915_private *i915,
 				       u32 mode_clock, u32 mode_hdisplay,
@@ -907,11 +917,18 @@  u32 get_max_compressed_bpp_with_joiner(struct drm_i915_private *i915,
 	max_bpp_small_joiner_ram = small_joiner_ram_max_bpp(display, mode_hdisplay,
 							    num_joined_pipes);
 
-	if (num_joined_pipes == 2) {
+	if (num_joined_pipes > 1) {
+		u32 max_bpp;
 		u32 max_bpp_bigjoiner = bigjoiner_bw_max_bpp(display, mode_clock,
 							     num_joined_pipes);
 
-		return min(max_bpp_small_joiner_ram, max_bpp_bigjoiner);
+		max_bpp = min(max_bpp_small_joiner_ram, max_bpp_bigjoiner);
+
+		if (num_joined_pipes == 2)
+			return max_bpp;
+
+		if (num_joined_pipes == 4)
+			return min(max_bpp, ultrajoiner_ram_max_bpp(mode_hdisplay));
 	}
 
 	return max_bpp_small_joiner_ram;