[4/7] drm/i915: Fix wrongly populated plane possible_crtcs bit mask
diff mbox series

Message ID 20200204112927.17391-5-anshuman.gupta@intel.com
State New
Headers show
Series
  • 3 display pipes combination system support
Related show

Commit Message

Anshuman Gupta Feb. 4, 2020, 11:29 a.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.

changes since RFC:
- Simplify the possible_crtcs initialization. [Ville]

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 | 12 ++++++++++++
 drivers/gpu/drm/i915/display/intel_sprite.c  |  2 --
 2 files changed, 12 insertions(+), 2 deletions(-)

Comments

Ville Syrjälä Feb. 4, 2020, 2:30 p.m. UTC | #1
On Tue, Feb 04, 2020 at 04:59:24PM +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.
> 
> changes since RFC:
> - Simplify the possible_crtcs initialization. [Ville]
> 
> 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 | 12 ++++++++++++
>  drivers/gpu/drm/i915/display/intel_sprite.c  |  2 --
>  2 files changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index cf36c3d0f8fc..7c51eb3faeb3 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -16407,6 +16407,17 @@ static void intel_crtc_free(struct intel_crtc *crtc)
>  	kfree(crtc);
>  }
>  
> +static void intel_plane_possible_crtc_init(struct drm_i915_private *dev_priv)
> +{
> +	struct intel_crtc *crtc;

Move this declaration into the loop body.

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

> +	struct intel_plane *plane;
> +
> +	for_each_intel_plane(&dev_priv->drm, plane) {
> +		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;
> @@ -17546,6 +17557,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
>  		}
>  	}
>  
> +	intel_plane_possible_crtc_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 fca77ec1e0dd..4a5b192678bf 100644
> --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> @@ -3023,8 +3023,6 @@ 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,
>  				       formats, num_formats, modifiers,
> -- 
> 2.24.0
Ville Syrjälä Feb. 4, 2020, 4:44 p.m. UTC | #2
On Tue, Feb 04, 2020 at 04:30:16PM +0200, Ville Syrjälä wrote:
> On Tue, Feb 04, 2020 at 04:59:24PM +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.
> > 
> > changes since RFC:
> > - Simplify the possible_crtcs initialization. [Ville]
> > 
> > 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 | 12 ++++++++++++
> >  drivers/gpu/drm/i915/display/intel_sprite.c  |  2 --
> >  2 files changed, 12 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index cf36c3d0f8fc..7c51eb3faeb3 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -16407,6 +16407,17 @@ static void intel_crtc_free(struct intel_crtc *crtc)
> >  	kfree(crtc);
> >  }
> >  
> > +static void intel_plane_possible_crtc_init(struct drm_i915_private *dev_priv)
> > +{
> > +	struct intel_crtc *crtc;
> 
> Move this declaration into the loop body.
> 
> With that
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> > +	struct intel_plane *plane;
> > +
> > +	for_each_intel_plane(&dev_priv->drm, plane) {
> > +		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;
> > @@ -17546,6 +17557,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
> >  		}
> >  	}
> >  
> > +	intel_plane_possible_crtc_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 fca77ec1e0dd..4a5b192678bf 100644
> > --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> > @@ -3023,8 +3023,6 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
> >  	else
> >  		plane_type = DRM_PLANE_TYPE_OVERLAY;
> >  
> > -	possible_crtcs = BIT(pipe);
> > -

Actually that now contains stack garbage. Pls remove the variable
entire and just pass zero to the thing.

> >  	ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
> >  				       possible_crtcs, plane_funcs,
> >  				       formats, num_formats, modifiers,
> > -- 
> > 2.24.0
> 
> -- 
> Ville Syrjälä
> Intel
Anshuman Gupta Feb. 6, 2020, 10:15 a.m. UTC | #3
On 2020-02-04 at 18:44:32 +0200, Ville Syrjälä wrote:
> On Tue, Feb 04, 2020 at 04:30:16PM +0200, Ville Syrjälä wrote:
> > On Tue, Feb 04, 2020 at 04:59:24PM +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.
> > > 
> > > changes since RFC:
> > > - Simplify the possible_crtcs initialization. [Ville]
> > > 
> > > 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 | 12 ++++++++++++
> > >  drivers/gpu/drm/i915/display/intel_sprite.c  |  2 --
> > >  2 files changed, 12 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > > index cf36c3d0f8fc..7c51eb3faeb3 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > @@ -16407,6 +16407,17 @@ static void intel_crtc_free(struct intel_crtc *crtc)
> > >  	kfree(crtc);
> > >  }
> > >  
> > > +static void intel_plane_possible_crtc_init(struct drm_i915_private *dev_priv)
> > > +{
> > > +	struct intel_crtc *crtc;
> > 
> > Move this declaration into the loop body.
> > 
> > With that
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Thanks Ville for review, I will move it to loop body.
Thanks,
Anshuman
> > 
> > > +	struct intel_plane *plane;
> > > +
> > > +	for_each_intel_plane(&dev_priv->drm, plane) {
> > > +		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;
> > > @@ -17546,6 +17557,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
> > >  		}
> > >  	}
> > >  
> > > +	intel_plane_possible_crtc_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 fca77ec1e0dd..4a5b192678bf 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> > > @@ -3023,8 +3023,6 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
> > >  	else
> > >  		plane_type = DRM_PLANE_TYPE_OVERLAY;
> > >  
> > > -	possible_crtcs = BIT(pipe);
> > > -
> 
> Actually that now contains stack garbage. Pls remove the variable
> entire and just pass zero to the thing.
> 
> > >  	ret = drm_universal_plane_init(&dev_priv->drm, &plane->base,
> > >  				       possible_crtcs, plane_funcs,
> > >  				       formats, num_formats, modifiers,
> > > -- 
> > > 2.24.0
> > 
> > -- 
> > Ville Syrjälä
> > Intel
> 
> -- 
> Ville Syrjälä
> Intel

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index cf36c3d0f8fc..7c51eb3faeb3 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16407,6 +16407,17 @@  static void intel_crtc_free(struct intel_crtc *crtc)
 	kfree(crtc);
 }
 
+static void intel_plane_possible_crtc_init(struct drm_i915_private *dev_priv)
+{
+	struct intel_crtc *crtc;
+	struct intel_plane *plane;
+
+	for_each_intel_plane(&dev_priv->drm, plane) {
+		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;
@@ -17546,6 +17557,7 @@  int intel_modeset_init(struct drm_i915_private *i915)
 		}
 	}
 
+	intel_plane_possible_crtc_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 fca77ec1e0dd..4a5b192678bf 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -3023,8 +3023,6 @@  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,
 				       formats, num_formats, modifiers,