diff mbox

drm/i915: Workaround CHV pipe C cursor fail

Message ID 1450459479-16286-1-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Dec. 18, 2015, 5:24 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Turns out CHV pipe C was glued on somewhat poorly, and there's something
wrong with the cursor. If the cursor straddles the left screen edge,
and is then moved away from the edge or disabled, the pipe will often
underrun. If enough underruns are triggered quickly enough the pipe
will fall over and die (it just scans out a solid color and reports
a constant underrun). We need to turn the disp2d power well off and
on again to recover the pipe.

None of that is very nice for the user, so let's just refuse to place
the cursor in the compromised position. The ddx appears to fall back
to swcursor when the ioctl returns an error, so theoretically there's
no loss of functionality for the user (discounting swcursor bugs).
I suppose most cursors images actually have the hotspot not exactly
at 0,0 so under typical conditions the fallback will in fact kick in
as soon as the cursor touches the left edge of the screen.

Any atomic compositor should anyway be prepared to fall back to
GPU composition when things don't work out, so there should be no
problem with those.

Other things that I tried to solve this include flipping all
display related clock gating knobs I could find, increasing the
minimum gtt alignment all the way up to 512k. I also tried to see
if there are more specific screen coordinates that hit the bug, but
the findings were somewhat inconclusive. Sometimes the failures
happen almost across the whole left edge, sometimes more at the very
top and around the bottom half. I wasn't able to find any real pattern
to these variations, so it seems our only choice is to just refuse
to straddle the left screen edge at all.

Cc: stable@vger.kernel.org
Cc: Jason Plum <max@warheads.net>
Testcase: igt/kms_chv_cursor_fail
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92826
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Daniel Vetter Dec. 21, 2015, 1:49 p.m. UTC | #1
On Fri, Dec 18, 2015 at 07:24:39PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Turns out CHV pipe C was glued on somewhat poorly, and there's something
> wrong with the cursor. If the cursor straddles the left screen edge,
> and is then moved away from the edge or disabled, the pipe will often
> underrun. If enough underruns are triggered quickly enough the pipe
> will fall over and die (it just scans out a solid color and reports
> a constant underrun). We need to turn the disp2d power well off and
> on again to recover the pipe.
> 
> None of that is very nice for the user, so let's just refuse to place
> the cursor in the compromised position. The ddx appears to fall back
> to swcursor when the ioctl returns an error, so theoretically there's
> no loss of functionality for the user (discounting swcursor bugs).
> I suppose most cursors images actually have the hotspot not exactly
> at 0,0 so under typical conditions the fallback will in fact kick in
> as soon as the cursor touches the left edge of the screen.
> 
> Any atomic compositor should anyway be prepared to fall back to
> GPU composition when things don't work out, so there should be no
> problem with those.
> 
> Other things that I tried to solve this include flipping all
> display related clock gating knobs I could find, increasing the
> minimum gtt alignment all the way up to 512k. I also tried to see
> if there are more specific screen coordinates that hit the bug, but
> the findings were somewhat inconclusive. Sometimes the failures
> happen almost across the whole left edge, sometimes more at the very
> top and around the bottom half. I wasn't able to find any real pattern
> to these variations, so it seems our only choice is to just refuse
> to straddle the left screen edge at all.
> 
> Cc: stable@vger.kernel.org
> Cc: Jason Plum <max@warheads.net>
> Testcase: igt/kms_chv_cursor_fail
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92826
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Well can't really review with Bspec and I don't expect we can get
confirmation from hw engineers. But does what it says in the commit
message.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index abd2d2944022..8acc66b95139 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14059,6 +14059,7 @@ intel_check_cursor_plane(struct drm_plane *plane,
>  	struct drm_crtc *crtc = crtc_state->base.crtc;
>  	struct drm_framebuffer *fb = state->base.fb;
>  	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> +	enum pipe pipe = to_intel_plane(plane)->pipe;
>  	unsigned stride;
>  	int ret;
>  
> @@ -14092,6 +14093,22 @@ intel_check_cursor_plane(struct drm_plane *plane,
>  		return -EINVAL;
>  	}
>  
> +	/*
> +	 * There's something wrong with the cursor on CHV pipe C.
> +	 * If it straddles the left edge of the screen then
> +	 * moving it away from the edge or disabling it often
> +	 * results in a pipe underrun, and often that can lead to
> +	 * dead pipe (constant underrun reported, and it scans
> +	 * out just a solid color). To recover from that, the
> +	 * display power well must be turned off and on again.
> +	 * Refuse the put the cursor into that compromised position.
> +	 */
> +	if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C &&
> +	    state->visible && state->base.crtc_x < 0) {
> +		DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");
> +		return -EINVAL;
> +	}
> +
>  	return 0;
>  }
>  
> -- 
> 2.4.10
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter Dec. 21, 2015, 1:52 p.m. UTC | #2
On Mon, Dec 21, 2015 at 02:49:18PM +0100, Daniel Vetter wrote:
> On Fri, Dec 18, 2015 at 07:24:39PM +0200, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Turns out CHV pipe C was glued on somewhat poorly, and there's something
> > wrong with the cursor. If the cursor straddles the left screen edge,
> > and is then moved away from the edge or disabled, the pipe will often
> > underrun. If enough underruns are triggered quickly enough the pipe
> > will fall over and die (it just scans out a solid color and reports
> > a constant underrun). We need to turn the disp2d power well off and
> > on again to recover the pipe.
> > 
> > None of that is very nice for the user, so let's just refuse to place
> > the cursor in the compromised position. The ddx appears to fall back
> > to swcursor when the ioctl returns an error, so theoretically there's
> > no loss of functionality for the user (discounting swcursor bugs).
> > I suppose most cursors images actually have the hotspot not exactly
> > at 0,0 so under typical conditions the fallback will in fact kick in
> > as soon as the cursor touches the left edge of the screen.
> > 
> > Any atomic compositor should anyway be prepared to fall back to
> > GPU composition when things don't work out, so there should be no
> > problem with those.
> > 
> > Other things that I tried to solve this include flipping all
> > display related clock gating knobs I could find, increasing the
> > minimum gtt alignment all the way up to 512k. I also tried to see
> > if there are more specific screen coordinates that hit the bug, but
> > the findings were somewhat inconclusive. Sometimes the failures
> > happen almost across the whole left edge, sometimes more at the very
> > top and around the bottom half. I wasn't able to find any real pattern
> > to these variations, so it seems our only choice is to just refuse
> > to straddle the left screen edge at all.
> > 
> > Cc: stable@vger.kernel.org
> > Cc: Jason Plum <max@warheads.net>
> > Testcase: igt/kms_chv_cursor_fail
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92826
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Well can't really review with Bspec and I don't expect we can get
> confirmation from hw engineers. But does what it says in the commit
> message.
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

And applied to dinq since that's our new flow even for fixes.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index abd2d2944022..8acc66b95139 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -14059,6 +14059,7 @@ intel_check_cursor_plane(struct drm_plane *plane,
> >  	struct drm_crtc *crtc = crtc_state->base.crtc;
> >  	struct drm_framebuffer *fb = state->base.fb;
> >  	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
> > +	enum pipe pipe = to_intel_plane(plane)->pipe;
> >  	unsigned stride;
> >  	int ret;
> >  
> > @@ -14092,6 +14093,22 @@ intel_check_cursor_plane(struct drm_plane *plane,
> >  		return -EINVAL;
> >  	}
> >  
> > +	/*
> > +	 * There's something wrong with the cursor on CHV pipe C.
> > +	 * If it straddles the left edge of the screen then
> > +	 * moving it away from the edge or disabling it often
> > +	 * results in a pipe underrun, and often that can lead to
> > +	 * dead pipe (constant underrun reported, and it scans
> > +	 * out just a solid color). To recover from that, the
> > +	 * display power well must be turned off and on again.
> > +	 * Refuse the put the cursor into that compromised position.
> > +	 */
> > +	if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C &&
> > +	    state->visible && state->base.crtc_x < 0) {
> > +		DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");
> > +		return -EINVAL;
> > +	}
> > +
> >  	return 0;
> >  }
> >  
> > -- 
> > 2.4.10
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index abd2d2944022..8acc66b95139 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14059,6 +14059,7 @@  intel_check_cursor_plane(struct drm_plane *plane,
 	struct drm_crtc *crtc = crtc_state->base.crtc;
 	struct drm_framebuffer *fb = state->base.fb;
 	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
+	enum pipe pipe = to_intel_plane(plane)->pipe;
 	unsigned stride;
 	int ret;
 
@@ -14092,6 +14093,22 @@  intel_check_cursor_plane(struct drm_plane *plane,
 		return -EINVAL;
 	}
 
+	/*
+	 * There's something wrong with the cursor on CHV pipe C.
+	 * If it straddles the left edge of the screen then
+	 * moving it away from the edge or disabling it often
+	 * results in a pipe underrun, and often that can lead to
+	 * dead pipe (constant underrun reported, and it scans
+	 * out just a solid color). To recover from that, the
+	 * display power well must be turned off and on again.
+	 * Refuse the put the cursor into that compromised position.
+	 */
+	if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C &&
+	    state->visible && state->base.crtc_x < 0) {
+		DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }