diff mbox series

[v3,4/7] drm/i915: Fix wrongly populated plane possible_crtcs bit mask

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

Commit Message

Gupta, Anshuman Feb. 24, 2020, 12:40 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_crtcs mask.

changes since RFC:
- Simplify the possible_crtcs initialization. [Ville]
v2:
- Removed the unnecessary stack garbage possible_crtcs to
  drm_universal_plane_init. [Ville]
v3:
- Combine the intel_crtc assignment and declaration. [Ville]

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: 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 | 13 +++++++++++++
 drivers/gpu/drm/i915/display/intel_sprite.c  |  5 +----
 2 files changed, 14 insertions(+), 4 deletions(-)

Comments

Ville Syrjälä Feb. 25, 2020, 3:06 p.m. UTC | #1
On Mon, Feb 24, 2020 at 06:10:01PM +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_crtcs mask.
> 
> changes since RFC:
> - Simplify the possible_crtcs initialization. [Ville]
> v2:
> - Removed the unnecessary stack garbage possible_crtcs to
>   drm_universal_plane_init. [Ville]
> v3:
> - Combine the intel_crtc assignment and declaration. [Ville]
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: 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 | 13 +++++++++++++
>  drivers/gpu/drm/i915/display/intel_sprite.c  |  5 +----
>  2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index aacbdc47fcea..41a0f2e9b6b9 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16628,6 +16628,18 @@ static void intel_crtc_free(struct intel_crtc *crtc)
>  	kfree(crtc);
>  }
>  
> +static void intel_plane_possible_crtcs_init(struct drm_i915_private *dev_priv)
> +{
> +	struct intel_plane *plane;
> +
> +	for_each_intel_plane(&dev_priv->drm, plane) {
> +		struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
> +								  plane->pipe);
> +
> +		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;
> @@ -17843,6 +17855,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
>  		}
>  	}
>  
> +	intel_plane_possible_crtcs_init(i915);
>  	intel_shared_dpll_init(dev);
>  	intel_update_fdi_pll_freq(i915);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
> index 7abeefe8dce5..b5c7b271a1a4 100644
> --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> @@ -3011,7 +3011,6 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
>  	struct intel_plane *plane;
>  	enum drm_plane_type plane_type;
>  	unsigned int supported_rotations;
> -	unsigned int possible_crtcs;
>  	const u64 *modifiers;
>  	const u32 *formats;
>  	int num_formats;
> @@ -3066,10 +3065,8 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
>  	else
>  		plane_type = DRM_PLANE_TYPE_OVERLAY;
>  
> -	possible_crtcs = BIT(pipe);
> -
>  	ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
> -				       possible_crtcs, plane_funcs,
> +				       0, plane_funcs,
>  				       formats, num_formats, modifiers,
>  				       plane_type,
>  				       "plane %d%c", plane_id + 1,

Looks like you missed all the other places that do this:
intel_primary_plane_create(), intel_sprite_plane_create(),
intel_cursor_plane_create().

Apart from that everything in the series looks ready.
Ville Syrjälä Feb. 26, 2020, 3:09 p.m. UTC | #2
On Tue, Feb 25, 2020 at 05:06:39PM +0200, Ville Syrjälä wrote:
> On Mon, Feb 24, 2020 at 06:10:01PM +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_crtcs mask.
> > 
> > changes since RFC:
> > - Simplify the possible_crtcs initialization. [Ville]
> > v2:
> > - Removed the unnecessary stack garbage possible_crtcs to
> >   drm_universal_plane_init. [Ville]
> > v3:
> > - Combine the intel_crtc assignment and declaration. [Ville]
> > 
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Reviewed-by: 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 | 13 +++++++++++++
> >  drivers/gpu/drm/i915/display/intel_sprite.c  |  5 +----
> >  2 files changed, 14 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index aacbdc47fcea..41a0f2e9b6b9 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -16628,6 +16628,18 @@ static void intel_crtc_free(struct intel_crtc *crtc)
> >  	kfree(crtc);
> >  }
> >  
> > +static void intel_plane_possible_crtcs_init(struct drm_i915_private *dev_priv)
> > +{
> > +	struct intel_plane *plane;
> > +
> > +	for_each_intel_plane(&dev_priv->drm, plane) {
> > +		struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
> > +								  plane->pipe);
> > +
> > +		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;
> > @@ -17843,6 +17855,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
> >  		}
> >  	}
> >  
> > +	intel_plane_possible_crtcs_init(i915);
> >  	intel_shared_dpll_init(dev);
> >  	intel_update_fdi_pll_freq(i915);
> >  
> > diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
> > index 7abeefe8dce5..b5c7b271a1a4 100644
> > --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> > @@ -3011,7 +3011,6 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
> >  	struct intel_plane *plane;
> >  	enum drm_plane_type plane_type;
> >  	unsigned int supported_rotations;
> > -	unsigned int possible_crtcs;
> >  	const u64 *modifiers;
> >  	const u32 *formats;
> >  	int num_formats;
> > @@ -3066,10 +3065,8 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
> >  	else
> >  		plane_type = DRM_PLANE_TYPE_OVERLAY;
> >  
> > -	possible_crtcs = BIT(pipe);
> > -
> >  	ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
> > -				       possible_crtcs, plane_funcs,
> > +				       0, plane_funcs,
> >  				       formats, num_formats, modifiers,
> >  				       plane_type,
> >  				       "plane %d%c", plane_id + 1,
> 
> Looks like you missed all the other places that do this:
> intel_primary_plane_create(), intel_sprite_plane_create(),
> intel_cursor_plane_create().
> 
> Apart from that everything in the series looks ready.

I pushed the other patches to dinq. Thanks.
Gupta, Anshuman Feb. 26, 2020, 3:24 p.m. UTC | #3
On 2020-02-26 at 17:09:43 +0200, Ville Syrjälä wrote:
> On Tue, Feb 25, 2020 at 05:06:39PM +0200, Ville Syrjälä wrote:
> > On Mon, Feb 24, 2020 at 06:10:01PM +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_crtcs mask.
> > > 
> > > changes since RFC:
> > > - Simplify the possible_crtcs initialization. [Ville]
> > > v2:
> > > - Removed the unnecessary stack garbage possible_crtcs to
> > >   drm_universal_plane_init. [Ville]
> > > v3:
> > > - Combine the intel_crtc assignment and declaration. [Ville]
> > > 
> > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Reviewed-by: 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 | 13 +++++++++++++
> > >  drivers/gpu/drm/i915/display/intel_sprite.c  |  5 +----
> > >  2 files changed, 14 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > > index aacbdc47fcea..41a0f2e9b6b9 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > @@ -16628,6 +16628,18 @@ static void intel_crtc_free(struct intel_crtc *crtc)
> > >  	kfree(crtc);
> > >  }
> > >  
> > > +static void intel_plane_possible_crtcs_init(struct drm_i915_private *dev_priv)
> > > +{
> > > +	struct intel_plane *plane;
> > > +
> > > +	for_each_intel_plane(&dev_priv->drm, plane) {
> > > +		struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
> > > +								  plane->pipe);
> > > +
> > > +		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;
> > > @@ -17843,6 +17855,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
> > >  		}
> > >  	}
> > >  
> > > +	intel_plane_possible_crtcs_init(i915);
> > >  	intel_shared_dpll_init(dev);
> > >  	intel_update_fdi_pll_freq(i915);
> > >  
> > > diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
> > > index 7abeefe8dce5..b5c7b271a1a4 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> > > @@ -3011,7 +3011,6 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
> > >  	struct intel_plane *plane;
> > >  	enum drm_plane_type plane_type;
> > >  	unsigned int supported_rotations;
> > > -	unsigned int possible_crtcs;
> > >  	const u64 *modifiers;
> > >  	const u32 *formats;
> > >  	int num_formats;
> > > @@ -3066,10 +3065,8 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
> > >  	else
> > >  		plane_type = DRM_PLANE_TYPE_OVERLAY;
> > >  
> > > -	possible_crtcs = BIT(pipe);
> > > -
> > >  	ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
> > > -				       possible_crtcs, plane_funcs,
> > > +				       0, plane_funcs,
> > >  				       formats, num_formats, modifiers,
> > >  				       plane_type,
> > >  				       "plane %d%c", plane_id + 1,
> > 
> > Looks like you missed all the other places that do this:
> > intel_primary_plane_create(), intel_sprite_plane_create(),
> > intel_cursor_plane_create().
Yes i missed intel_cursor_plane_create(), but other two sprite and
primary using the skl_universal_plane_create() for gen > gen9 and
having early return, considering that i have modiefied only 
skl_universal_plane_create() and overlooked intel_cursor_plane_create().
Shall i fix this for all *plane_create() or just for cursor?
> > 
> > Apart from that everything in the series looks ready.
> 
> I pushed the other patches to dinq. Thanks.
Thanks for merging the pacthes.
Thanks,
Anshuman Gupta.
> 
> -- 
> Ville Syrjälä
> Intel
Ville Syrjälä Feb. 26, 2020, 5:27 p.m. UTC | #4
On Wed, Feb 26, 2020 at 08:54:08PM +0530, Anshuman Gupta wrote:
> On 2020-02-26 at 17:09:43 +0200, Ville Syrjälä wrote:
> > On Tue, Feb 25, 2020 at 05:06:39PM +0200, Ville Syrjälä wrote:
> > > On Mon, Feb 24, 2020 at 06:10:01PM +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_crtcs mask.
> > > > 
> > > > changes since RFC:
> > > > - Simplify the possible_crtcs initialization. [Ville]
> > > > v2:
> > > > - Removed the unnecessary stack garbage possible_crtcs to
> > > >   drm_universal_plane_init. [Ville]
> > > > v3:
> > > > - Combine the intel_crtc assignment and declaration. [Ville]
> > > > 
> > > > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > > Reviewed-by: 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 | 13 +++++++++++++
> > > >  drivers/gpu/drm/i915/display/intel_sprite.c  |  5 +----
> > > >  2 files changed, 14 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > > > index aacbdc47fcea..41a0f2e9b6b9 100644
> > > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > > @@ -16628,6 +16628,18 @@ static void intel_crtc_free(struct intel_crtc *crtc)
> > > >  	kfree(crtc);
> > > >  }
> > > >  
> > > > +static void intel_plane_possible_crtcs_init(struct drm_i915_private *dev_priv)
> > > > +{
> > > > +	struct intel_plane *plane;
> > > > +
> > > > +	for_each_intel_plane(&dev_priv->drm, plane) {
> > > > +		struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
> > > > +								  plane->pipe);
> > > > +
> > > > +		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;
> > > > @@ -17843,6 +17855,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
> > > >  		}
> > > >  	}
> > > >  
> > > > +	intel_plane_possible_crtcs_init(i915);
> > > >  	intel_shared_dpll_init(dev);
> > > >  	intel_update_fdi_pll_freq(i915);
> > > >  
> > > > diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
> > > > index 7abeefe8dce5..b5c7b271a1a4 100644
> > > > --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> > > > +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> > > > @@ -3011,7 +3011,6 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
> > > >  	struct intel_plane *plane;
> > > >  	enum drm_plane_type plane_type;
> > > >  	unsigned int supported_rotations;
> > > > -	unsigned int possible_crtcs;
> > > >  	const u64 *modifiers;
> > > >  	const u32 *formats;
> > > >  	int num_formats;
> > > > @@ -3066,10 +3065,8 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
> > > >  	else
> > > >  		plane_type = DRM_PLANE_TYPE_OVERLAY;
> > > >  
> > > > -	possible_crtcs = BIT(pipe);
> > > > -
> > > >  	ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
> > > > -				       possible_crtcs, plane_funcs,
> > > > +				       0, plane_funcs,
> > > >  				       formats, num_formats, modifiers,
> > > >  				       plane_type,
> > > >  				       "plane %d%c", plane_id + 1,
> > > 
> > > Looks like you missed all the other places that do this:
> > > intel_primary_plane_create(), intel_sprite_plane_create(),
> > > intel_cursor_plane_create().
> Yes i missed intel_cursor_plane_create(), but other two sprite and
> primary using the skl_universal_plane_create() for gen > gen9 and
> having early return, considering that i have modiefied only 
> skl_universal_plane_create() and overlooked intel_cursor_plane_create().
> Shall i fix this for all *plane_create() or just for cursor?

Just change all of them. We don't want to accumulate pointless
differences between the platforms.
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 aacbdc47fcea..41a0f2e9b6b9 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16628,6 +16628,18 @@  static void intel_crtc_free(struct intel_crtc *crtc)
 	kfree(crtc);
 }
 
+static void intel_plane_possible_crtcs_init(struct drm_i915_private *dev_priv)
+{
+	struct intel_plane *plane;
+
+	for_each_intel_plane(&dev_priv->drm, plane) {
+		struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
+								  plane->pipe);
+
+		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;
@@ -17843,6 +17855,7 @@  int intel_modeset_init(struct drm_i915_private *i915)
 		}
 	}
 
+	intel_plane_possible_crtcs_init(i915);
 	intel_shared_dpll_init(dev);
 	intel_update_fdi_pll_freq(i915);
 
diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
index 7abeefe8dce5..b5c7b271a1a4 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -3011,7 +3011,6 @@  skl_universal_plane_create(struct drm_i915_private *dev_priv,
 	struct intel_plane *plane;
 	enum drm_plane_type plane_type;
 	unsigned int supported_rotations;
-	unsigned int possible_crtcs;
 	const u64 *modifiers;
 	const u32 *formats;
 	int num_formats;
@@ -3066,10 +3065,8 @@  skl_universal_plane_create(struct drm_i915_private *dev_priv,
 	else
 		plane_type = DRM_PLANE_TYPE_OVERLAY;
 
-	possible_crtcs = BIT(pipe);
-
 	ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
-				       possible_crtcs, plane_funcs,
+				       0, plane_funcs,
 				       formats, num_formats, modifiers,
 				       plane_type,
 				       "plane %d%c", plane_id + 1,