diff mbox series

[RFC,3/6] drm/i915: Fix wrongly populated plane possible_crtcs bit mask

Message ID 20200123132659.725-4-anshuman.gupta@intel.com (mailing list archive)
State New, archived
Headers show
Series 3 display pipes combination system support | expand

Commit Message

Gupta, Anshuman Jan. 23, 2020, 1:26 p.m. UTC
As a disabled pipe in pipe_mask is not having a valid intel crtc,
driver wrongly populates the possible_crtcs mask while initializing
the plane for a CRTC. Fixing up the plane possible_crtc mask.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Ville Syrjala Jan. 23, 2020, 1:47 p.m. UTC | #1
On Thu, Jan 23, 2020 at 06:56:56PM +0530, Anshuman Gupta wrote:
> As a disabled pipe in pipe_mask is not having a valid intel crtc,
> driver wrongly populates the possible_crtcs mask while initializing
> the plane for a CRTC. Fixing up the plane possible_crtc mask.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 23 ++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index afd8d43160c6..b250b31f6000 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16407,6 +16407,28 @@ static void intel_crtc_free(struct intel_crtc *crtc)
>  	kfree(crtc);
>  }
>  
> +static void intel_plane_possible_crtc_fixup(struct drm_i915_private *dev_priv)
> +{
> +	struct intel_crtc *crtc;
> +	struct intel_plane *plane;
> +
> +	/*
> +	 * if in case the disabled fused pipe is not the last pipe,
> +	 * it requires to fix the wrong populated possible_crtcs mask.
> +	 */
> +	if (is_power_of_2(INTEL_INFO(dev_priv)->pipe_mask + 1))
> +		return;

I don't undestand what you're trying to do here. Looks totally
pointless.

> +
> +	for_each_intel_crtc(&dev_priv->drm, crtc) {
> +		for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
> +			if (WARN_ON(!(plane->base.possible_crtcs & BIT(crtc->pipe))))
> +				return;

Rather ugly abuse of possible_crtcs. I would remove the current
possible_crtcs assignments totally, and just do something simple like

for_each_intel_plane() {
	crtc = crtc_for_pipe(plane->pipe);
	plane->possible_crtcs = crtc_mask(&crtc->base);
}


> +			plane->base.possible_crtcs =
> +					drm_crtc_mask(&crtc->base);
> +		}
> +	}
> +}
> +
>  static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
>  {
>  	struct intel_plane *primary, *cursor;
> @@ -17544,6 +17566,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
>  		}
>  	}
>  
> +	intel_plane_possible_crtc_fixup(i915);
>  	intel_shared_dpll_init(dev);
>  	intel_update_fdi_pll_freq(i915);
>  
> -- 
> 2.24.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index afd8d43160c6..b250b31f6000 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16407,6 +16407,28 @@  static void intel_crtc_free(struct intel_crtc *crtc)
 	kfree(crtc);
 }
 
+static void intel_plane_possible_crtc_fixup(struct drm_i915_private *dev_priv)
+{
+	struct intel_crtc *crtc;
+	struct intel_plane *plane;
+
+	/*
+	 * if in case the disabled fused pipe is not the last pipe,
+	 * it requires to fix the wrong populated possible_crtcs mask.
+	 */
+	if (is_power_of_2(INTEL_INFO(dev_priv)->pipe_mask + 1))
+		return;
+
+	for_each_intel_crtc(&dev_priv->drm, crtc) {
+		for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
+			if (WARN_ON(!(plane->base.possible_crtcs & BIT(crtc->pipe))))
+				return;
+			plane->base.possible_crtcs =
+					drm_crtc_mask(&crtc->base);
+		}
+	}
+}
+
 static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 {
 	struct intel_plane *primary, *cursor;
@@ -17544,6 +17566,7 @@  int intel_modeset_init(struct drm_i915_private *i915)
 		}
 	}
 
+	intel_plane_possible_crtc_fixup(i915);
 	intel_shared_dpll_init(dev);
 	intel_update_fdi_pll_freq(i915);