diff mbox series

[RFC,2/6] drm/i915: Remove (pipe == crtc->index) asummption

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

Commit Message

Anshuman Gupta Jan. 23, 2020, 1:26 p.m. UTC
we can't have (pipe == crtc->index) assumption in
driver in order to support 3 non-contiguous
display pipe system.

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 | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Ville Syrjälä Jan. 23, 2020, 1:40 p.m. UTC | #1
On Thu, Jan 23, 2020 at 06:56:55PM +0530, Anshuman Gupta wrote:
> we can't have (pipe == crtc->index) assumption in
> driver in order to support 3 non-contiguous
> display pipe system.
> 
> 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 | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 878d331b9e8c..afd8d43160c6 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14070,11 +14070,11 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
>  	if (new_crtc_state->hw.active)
>  		I915_STATE_WARN(!(pll->active_mask & crtc_mask),
>  				"pll active mismatch (expected pipe %c in active mask 0x%02x)\n",
> -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> +				pipe_name(crtc->pipe), pll->active_mask);
>  	else
>  		I915_STATE_WARN(pll->active_mask & crtc_mask,
>  				"pll active mismatch (didn't expect pipe %c in active mask 0x%02x)\n",
> -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> +				pipe_name(crtc->pipe), pll->active_mask);
>  
>  	I915_STATE_WARN(!(pll->state.crtc_mask & crtc_mask),
>  			"pll enabled crtcs mismatch (expected 0x%x in 0x%02x)\n",
> @@ -14103,10 +14103,10 @@ verify_shared_dpll_state(struct intel_crtc *crtc,
>  
>  		I915_STATE_WARN(pll->active_mask & crtc_mask,
>  				"pll active mismatch (didn't expect pipe %c in active mask)\n",
> -				pipe_name(drm_crtc_index(&crtc->base)));
> +				pipe_name(crtc->pipe));
>  		I915_STATE_WARN(pll->state.crtc_mask & crtc_mask,
>  				"pll enabled crtcs mismatch (found %x in enabled mask)\n",
> -				pipe_name(drm_crtc_index(&crtc->base)));
> +				pipe_name(crtc->pipe));
>  	}
>  }
>  
> @@ -16485,8 +16485,6 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
>  
>  	intel_color_init(crtc);
>  
> -	WARN_ON(drm_crtc_index(&crtc->base) != crtc->pipe);
> -

The first and second hunks don't really have anything to do with
each other. Also the WARN_ON() should not be removed until all the
assumptions are fixed.

>  	return 0;
>  
>  fail:
> -- 
> 2.24.0
Jani Nikula Jan. 23, 2020, 1:49 p.m. UTC | #2
On Thu, 23 Jan 2020, Anshuman Gupta <anshuman.gupta@intel.com> wrote:
> we can't have (pipe == crtc->index) assumption in
> driver in order to support 3 non-contiguous
> display pipe system.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>

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

> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 878d331b9e8c..afd8d43160c6 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14070,11 +14070,11 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
>  	if (new_crtc_state->hw.active)
>  		I915_STATE_WARN(!(pll->active_mask & crtc_mask),
>  				"pll active mismatch (expected pipe %c in active mask 0x%02x)\n",
> -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> +				pipe_name(crtc->pipe), pll->active_mask);
>  	else
>  		I915_STATE_WARN(pll->active_mask & crtc_mask,
>  				"pll active mismatch (didn't expect pipe %c in active mask 0x%02x)\n",
> -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> +				pipe_name(crtc->pipe), pll->active_mask);
>  
>  	I915_STATE_WARN(!(pll->state.crtc_mask & crtc_mask),
>  			"pll enabled crtcs mismatch (expected 0x%x in 0x%02x)\n",
> @@ -14103,10 +14103,10 @@ verify_shared_dpll_state(struct intel_crtc *crtc,
>  
>  		I915_STATE_WARN(pll->active_mask & crtc_mask,
>  				"pll active mismatch (didn't expect pipe %c in active mask)\n",
> -				pipe_name(drm_crtc_index(&crtc->base)));
> +				pipe_name(crtc->pipe));
>  		I915_STATE_WARN(pll->state.crtc_mask & crtc_mask,
>  				"pll enabled crtcs mismatch (found %x in enabled mask)\n",
> -				pipe_name(drm_crtc_index(&crtc->base)));
> +				pipe_name(crtc->pipe));
>  	}
>  }
>  
> @@ -16485,8 +16485,6 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
>  
>  	intel_color_init(crtc);
>  
> -	WARN_ON(drm_crtc_index(&crtc->base) != crtc->pipe);
> -
>  	return 0;
>  
>  fail:
Anshuman Gupta Jan. 30, 2020, 12:02 p.m. UTC | #3
On 2020-01-23 at 15:40:57 +0200, Ville Syrjälä wrote:
> On Thu, Jan 23, 2020 at 06:56:55PM +0530, Anshuman Gupta wrote:
> > we can't have (pipe == crtc->index) assumption in
> > driver in order to support 3 non-contiguous
> > display pipe system.
> > 
> > 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 | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > index 878d331b9e8c..afd8d43160c6 100644
> > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > @@ -14070,11 +14070,11 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
> >  	if (new_crtc_state->hw.active)
> >  		I915_STATE_WARN(!(pll->active_mask & crtc_mask),
> >  				"pll active mismatch (expected pipe %c in active mask 0x%02x)\n",
> > -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> > +				pipe_name(crtc->pipe), pll->active_mask);
> >  	else
> >  		I915_STATE_WARN(pll->active_mask & crtc_mask,
> >  				"pll active mismatch (didn't expect pipe %c in active mask 0x%02x)\n",
> > -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> > +				pipe_name(crtc->pipe), pll->active_mask);
> >  
> >  	I915_STATE_WARN(!(pll->state.crtc_mask & crtc_mask),
> >  			"pll enabled crtcs mismatch (expected 0x%x in 0x%02x)\n",
> > @@ -14103,10 +14103,10 @@ verify_shared_dpll_state(struct intel_crtc *crtc,
> >  
> >  		I915_STATE_WARN(pll->active_mask & crtc_mask,
> >  				"pll active mismatch (didn't expect pipe %c in active mask)\n",
> > -				pipe_name(drm_crtc_index(&crtc->base)));
> > +				pipe_name(crtc->pipe));
> >  		I915_STATE_WARN(pll->state.crtc_mask & crtc_mask,
> >  				"pll enabled crtcs mismatch (found %x in enabled mask)\n",
> > -				pipe_name(drm_crtc_index(&crtc->base)));
> > +				pipe_name(crtc->pipe));
> >  	}
> >  }
> >  
> > @@ -16485,8 +16485,6 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
> >  
> >  	intel_color_init(crtc);
> >  
> > -	WARN_ON(drm_crtc_index(&crtc->base) != crtc->pipe);
> > -
> 
> The first and second hunks don't really have anything to do with
> each other. Also the WARN_ON() should not be removed until all the
> assumptions are fixed.
True there can be other assumptions as well, there are few, i have come to know
drm_handle_vblank(&dev_priv->drm, pipe) in gen8_de_irq_handler()
drm_wait_one_vblank(&dev_priv->drm, pipe) in intel_wait_for_vblank(),
i will fix these assumptions is next update, are there any other similar kind of
assumption on which u can throw some light to look for?
I am not sure how does above WARN_ON helps to know all such kind of 
assumptions, but it make sense to have it with FIXME.
Thanks,
Anshuman Gupta.
> 
> >  	return 0;
> >  
> >  fail:
> > -- 
> > 2.24.0
> 
> -- 
> Ville Syrjälä
> Intel
Ville Syrjälä Jan. 30, 2020, 1:35 p.m. UTC | #4
On Thu, Jan 30, 2020 at 05:32:01PM +0530, Anshuman Gupta wrote:
> On 2020-01-23 at 15:40:57 +0200, Ville Syrjälä wrote:
> > On Thu, Jan 23, 2020 at 06:56:55PM +0530, Anshuman Gupta wrote:
> > > we can't have (pipe == crtc->index) assumption in
> > > driver in order to support 3 non-contiguous
> > > display pipe system.
> > > 
> > > 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 | 10 ++++------
> > >  1 file changed, 4 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > > index 878d331b9e8c..afd8d43160c6 100644
> > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > @@ -14070,11 +14070,11 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
> > >  	if (new_crtc_state->hw.active)
> > >  		I915_STATE_WARN(!(pll->active_mask & crtc_mask),
> > >  				"pll active mismatch (expected pipe %c in active mask 0x%02x)\n",
> > > -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> > > +				pipe_name(crtc->pipe), pll->active_mask);
> > >  	else
> > >  		I915_STATE_WARN(pll->active_mask & crtc_mask,
> > >  				"pll active mismatch (didn't expect pipe %c in active mask 0x%02x)\n",
> > > -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> > > +				pipe_name(crtc->pipe), pll->active_mask);
> > >  
> > >  	I915_STATE_WARN(!(pll->state.crtc_mask & crtc_mask),
> > >  			"pll enabled crtcs mismatch (expected 0x%x in 0x%02x)\n",
> > > @@ -14103,10 +14103,10 @@ verify_shared_dpll_state(struct intel_crtc *crtc,
> > >  
> > >  		I915_STATE_WARN(pll->active_mask & crtc_mask,
> > >  				"pll active mismatch (didn't expect pipe %c in active mask)\n",
> > > -				pipe_name(drm_crtc_index(&crtc->base)));
> > > +				pipe_name(crtc->pipe));
> > >  		I915_STATE_WARN(pll->state.crtc_mask & crtc_mask,
> > >  				"pll enabled crtcs mismatch (found %x in enabled mask)\n",
> > > -				pipe_name(drm_crtc_index(&crtc->base)));
> > > +				pipe_name(crtc->pipe));
> > >  	}
> > >  }
> > >  
> > > @@ -16485,8 +16485,6 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
> > >  
> > >  	intel_color_init(crtc);
> > >  
> > > -	WARN_ON(drm_crtc_index(&crtc->base) != crtc->pipe);
> > > -
> > 
> > The first and second hunks don't really have anything to do with
> > each other. Also the WARN_ON() should not be removed until all the
> > assumptions are fixed.
> True there can be other assumptions as well, there are few, i have come to know
> drm_handle_vblank(&dev_priv->drm, pipe) in gen8_de_irq_handler()

In fact it's in all irq handlers.

> drm_wait_one_vblank(&dev_priv->drm, pipe) in intel_wait_for_vblank(),

Good catch. Totally forgot about these.

> i will fix these assumptions is next update, are there any other similar kind of
> assumption on which u can throw some light to look for?
> I am not sure how does above WARN_ON helps to know all such kind of 
> assumptions, but it make sense to have it with FIXME.

It doesn't help finding them, what it does is make people realize
that they're running a driver which is known to be broken.
Ville Syrjälä Jan. 30, 2020, 3:27 p.m. UTC | #5
On Thu, Jan 30, 2020 at 03:35:20PM +0200, Ville Syrjälä wrote:
> On Thu, Jan 30, 2020 at 05:32:01PM +0530, Anshuman Gupta wrote:
> > On 2020-01-23 at 15:40:57 +0200, Ville Syrjälä wrote:
> > > On Thu, Jan 23, 2020 at 06:56:55PM +0530, Anshuman Gupta wrote:
> > > > we can't have (pipe == crtc->index) assumption in
> > > > driver in order to support 3 non-contiguous
> > > > display pipe system.
> > > > 
> > > > 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 | 10 ++++------
> > > >  1 file changed, 4 insertions(+), 6 deletions(-)
> > > > 
> > > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> > > > index 878d331b9e8c..afd8d43160c6 100644
> > > > --- a/drivers/gpu/drm/i915/display/intel_display.c
> > > > +++ b/drivers/gpu/drm/i915/display/intel_display.c
> > > > @@ -14070,11 +14070,11 @@ verify_single_dpll_state(struct drm_i915_private *dev_priv,
> > > >  	if (new_crtc_state->hw.active)
> > > >  		I915_STATE_WARN(!(pll->active_mask & crtc_mask),
> > > >  				"pll active mismatch (expected pipe %c in active mask 0x%02x)\n",
> > > > -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> > > > +				pipe_name(crtc->pipe), pll->active_mask);
> > > >  	else
> > > >  		I915_STATE_WARN(pll->active_mask & crtc_mask,
> > > >  				"pll active mismatch (didn't expect pipe %c in active mask 0x%02x)\n",
> > > > -				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
> > > > +				pipe_name(crtc->pipe), pll->active_mask);
> > > >  
> > > >  	I915_STATE_WARN(!(pll->state.crtc_mask & crtc_mask),
> > > >  			"pll enabled crtcs mismatch (expected 0x%x in 0x%02x)\n",
> > > > @@ -14103,10 +14103,10 @@ verify_shared_dpll_state(struct intel_crtc *crtc,
> > > >  
> > > >  		I915_STATE_WARN(pll->active_mask & crtc_mask,
> > > >  				"pll active mismatch (didn't expect pipe %c in active mask)\n",
> > > > -				pipe_name(drm_crtc_index(&crtc->base)));
> > > > +				pipe_name(crtc->pipe));
> > > >  		I915_STATE_WARN(pll->state.crtc_mask & crtc_mask,
> > > >  				"pll enabled crtcs mismatch (found %x in enabled mask)\n",
> > > > -				pipe_name(drm_crtc_index(&crtc->base)));
> > > > +				pipe_name(crtc->pipe));
> > > >  	}
> > > >  }
> > > >  
> > > > @@ -16485,8 +16485,6 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
> > > >  
> > > >  	intel_color_init(crtc);
> > > >  
> > > > -	WARN_ON(drm_crtc_index(&crtc->base) != crtc->pipe);
> > > > -
> > > 
> > > The first and second hunks don't really have anything to do with
> > > each other. Also the WARN_ON() should not be removed until all the
> > > assumptions are fixed.
> > True there can be other assumptions as well, there are few, i have come to know
> > drm_handle_vblank(&dev_priv->drm, pipe) in gen8_de_irq_handler()
> 
> In fact it's in all irq handlers.
> 
> > drm_wait_one_vblank(&dev_priv->drm, pipe) in intel_wait_for_vblank(),
> 
> Good catch. Totally forgot about these.
> 
> > i will fix these assumptions is next update, are there any other similar kind of
> > assumption on which u can throw some light to look for?
> > I am not sure how does above WARN_ON helps to know all such kind of 
> > assumptions, but it make sense to have it with FIXME.
> 
> It doesn't help finding them, what it does is make people realize
> that they're running a driver which is known to be broken.

Just remembered another borked thing: trans_offsets[]. Some places use
that to check if the transcoder is present, and we don't take fusing
into account when filling that. Though looks like
intel_display_capture_error_state() is the only place where can
actually do the wrong thing (assuming EDP/DSI transcoders are never
fused off).
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 878d331b9e8c..afd8d43160c6 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -14070,11 +14070,11 @@  verify_single_dpll_state(struct drm_i915_private *dev_priv,
 	if (new_crtc_state->hw.active)
 		I915_STATE_WARN(!(pll->active_mask & crtc_mask),
 				"pll active mismatch (expected pipe %c in active mask 0x%02x)\n",
-				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
+				pipe_name(crtc->pipe), pll->active_mask);
 	else
 		I915_STATE_WARN(pll->active_mask & crtc_mask,
 				"pll active mismatch (didn't expect pipe %c in active mask 0x%02x)\n",
-				pipe_name(drm_crtc_index(&crtc->base)), pll->active_mask);
+				pipe_name(crtc->pipe), pll->active_mask);
 
 	I915_STATE_WARN(!(pll->state.crtc_mask & crtc_mask),
 			"pll enabled crtcs mismatch (expected 0x%x in 0x%02x)\n",
@@ -14103,10 +14103,10 @@  verify_shared_dpll_state(struct intel_crtc *crtc,
 
 		I915_STATE_WARN(pll->active_mask & crtc_mask,
 				"pll active mismatch (didn't expect pipe %c in active mask)\n",
-				pipe_name(drm_crtc_index(&crtc->base)));
+				pipe_name(crtc->pipe));
 		I915_STATE_WARN(pll->state.crtc_mask & crtc_mask,
 				"pll enabled crtcs mismatch (found %x in enabled mask)\n",
-				pipe_name(drm_crtc_index(&crtc->base)));
+				pipe_name(crtc->pipe));
 	}
 }
 
@@ -16485,8 +16485,6 @@  static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 
 	intel_color_init(crtc);
 
-	WARN_ON(drm_crtc_index(&crtc->base) != crtc->pipe);
-
 	return 0;
 
 fail: