diff mbox series

[6/6] drm/i915: Simplify xelpdp_is_only_pipe_per_dbuf_bank()

Message ID 20241031155646.15165-7-ville.syrjala@linux.intel.com (mailing list archive)
State New
Headers show
Series drm/i915: Sanitize MBUS joining | expand

Commit Message

Ville Syrjälä Oct. 31, 2024, 3:56 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Implement xelpdp_is_only_pipe_per_dbuf_bank() in a slightly
more straightforward way.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/skl_watermark.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Jani Nikula Nov. 1, 2024, 10:32 a.m. UTC | #1
On Thu, 31 Oct 2024, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Implement xelpdp_is_only_pipe_per_dbuf_bank() in a slightly
> more straightforward way.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Matter of taste, but at least this is less repetitive.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/skl_watermark.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c
> index 98f9e01b2a1c..d3bbf335c749 100644
> --- a/drivers/gpu/drm/i915/display/skl_watermark.c
> +++ b/drivers/gpu/drm/i915/display/skl_watermark.c
> @@ -3256,19 +3256,19 @@ static bool xelpdp_is_only_pipe_per_dbuf_bank(enum pipe pipe, u8 active_pipes)
>  {
>  	switch (pipe) {
>  	case PIPE_A:
> -		return !(active_pipes & BIT(PIPE_D));
>  	case PIPE_D:
> -		return !(active_pipes & BIT(PIPE_A));
> +		active_pipes &= BIT(PIPE_A) | BIT(PIPE_D);
> +		break;
>  	case PIPE_B:
> -		return !(active_pipes & BIT(PIPE_C));
>  	case PIPE_C:
> -		return !(active_pipes & BIT(PIPE_B));
> +		active_pipes &= BIT(PIPE_B) | BIT(PIPE_C);
> +		break;
>  	default: /* to suppress compiler warning */
>  		MISSING_CASE(pipe);
> -		break;
> +		return false;
>  	}
>  
> -	return false;
> +	return is_power_of_2(active_pipes);
>  }
>  
>  static u32 pipe_mbus_dbox_ctl(const struct intel_crtc *crtc,
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c
index 98f9e01b2a1c..d3bbf335c749 100644
--- a/drivers/gpu/drm/i915/display/skl_watermark.c
+++ b/drivers/gpu/drm/i915/display/skl_watermark.c
@@ -3256,19 +3256,19 @@  static bool xelpdp_is_only_pipe_per_dbuf_bank(enum pipe pipe, u8 active_pipes)
 {
 	switch (pipe) {
 	case PIPE_A:
-		return !(active_pipes & BIT(PIPE_D));
 	case PIPE_D:
-		return !(active_pipes & BIT(PIPE_A));
+		active_pipes &= BIT(PIPE_A) | BIT(PIPE_D);
+		break;
 	case PIPE_B:
-		return !(active_pipes & BIT(PIPE_C));
 	case PIPE_C:
-		return !(active_pipes & BIT(PIPE_B));
+		active_pipes &= BIT(PIPE_B) | BIT(PIPE_C);
+		break;
 	default: /* to suppress compiler warning */
 		MISSING_CASE(pipe);
-		break;
+		return false;
 	}
 
-	return false;
+	return is_power_of_2(active_pipes);
 }
 
 static u32 pipe_mbus_dbox_ctl(const struct intel_crtc *crtc,