Re: [Intel-gfx] [PATCH] drm/i915: Remove non-existent pipes from bigjoiner pipe mask

2022-11-20 Thread Murthy, Arun R
> -Original Message-
> From: Intel-gfx  On Behalf Of Ville
> Syrjala
> Sent: Saturday, November 19, 2022 12:22 AM
> To: intel-gfx@lists.freedesktop.org
> Cc: sta...@vger.kernel.org
> Subject: [Intel-gfx] [PATCH] drm/i915: Remove non-existent pipes from
> bigjoiner pipe mask
> 
> From: Ville Syrjälä 
> 
> bigjoiner_pipes() doesn't consider that:
> - RKL only has three pipes
> - some pipes may be fused off
> 
> This means that intel_atomic_check_bigjoiner() won't reject all configurations
> that would need a non-existent pipe.
> Instead we just keep on rolling witout actually having reserved the slave pipe
> we need.
> 
> It's possible that we don't outright explode anywhere due to this since eg.
> for_each_intel_crtc_in_pipe_mask() will only walk the crtcs we've registered
> even though the passed in pipe_mask asks for more of them. But clearly the
> thing won't do what is expected of it when the required pipes are not
> present.
> 
> Fix the problem by consulting the device info pipe_mask already in
> bigjoiner_pipes().
> 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Ville Syrjälä 
> ---
Reviewed-by: Arun R Murthy 

Thanks and Regards,
Arun R Murthy

>  drivers/gpu/drm/i915/display/intel_display.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index b3e23708d194..6c2686ecb62a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -3733,12 +3733,16 @@ static bool ilk_get_pipe_config(struct intel_crtc
> *crtc,
> 
>  static u8 bigjoiner_pipes(struct drm_i915_private *i915)  {
> + u8 pipes;
> +
>   if (DISPLAY_VER(i915) >= 12)
> - return BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D);
> + pipes = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D);
>   else if (DISPLAY_VER(i915) >= 11)
> - return BIT(PIPE_B) | BIT(PIPE_C);
> + pipes = BIT(PIPE_B) | BIT(PIPE_C);
>   else
> - return 0;
> + pipes = 0;
> +
> + return pipes & RUNTIME_INFO(i915)->pipe_mask;
>  }
> 
>  static bool transcoder_ddi_func_is_enabled(struct drm_i915_private
> *dev_priv,
> --
> 2.37.4



[Intel-gfx] [PATCH] drm/i915: Remove non-existent pipes from bigjoiner pipe mask

2022-11-18 Thread Ville Syrjala
From: Ville Syrjälä 

bigjoiner_pipes() doesn't consider that:
- RKL only has three pipes
- some pipes may be fused off

This means that intel_atomic_check_bigjoiner() won't reject
all configurations that would need a non-existent pipe.
Instead we just keep on rolling witout actually having
reserved the slave pipe we need.

It's possible that we don't outright explode anywhere due to
this since eg. for_each_intel_crtc_in_pipe_mask() will only
walk the crtcs we've registered even though the passed in
pipe_mask asks for more of them. But clearly the thing won't
do what is expected of it when the required pipes are not
present.

Fix the problem by consulting the device info pipe_mask already
in bigjoiner_pipes().

Cc: sta...@vger.kernel.org
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/i915/display/intel_display.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index b3e23708d194..6c2686ecb62a 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -3733,12 +3733,16 @@ static bool ilk_get_pipe_config(struct intel_crtc *crtc,
 
 static u8 bigjoiner_pipes(struct drm_i915_private *i915)
 {
+   u8 pipes;
+
if (DISPLAY_VER(i915) >= 12)
-   return BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D);
+   pipes = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D);
else if (DISPLAY_VER(i915) >= 11)
-   return BIT(PIPE_B) | BIT(PIPE_C);
+   pipes = BIT(PIPE_B) | BIT(PIPE_C);
else
-   return 0;
+   pipes = 0;
+
+   return pipes & RUNTIME_INFO(i915)->pipe_mask;
 }
 
 static bool transcoder_ddi_func_is_enabled(struct drm_i915_private *dev_priv,
-- 
2.37.4