intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915: Don't clobber crtc->fb when queue_flip fails
@ 2013-02-22 14:53 ville.syrjala
  2013-02-22 15:13 ` [Intel-gfx] " Chris Wilson
  2013-02-25 13:25 ` Mika Kuoppala
  0 siblings, 2 replies; 5+ messages in thread
From: ville.syrjala @ 2013-02-22 14:53 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ville Syrjälä, stable

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Restore crtc->fb to the old framebuffer if queue_flip fails.

While at it, kill the pointless intel_fb temp variable.

v2: Update crtc->fb before queue_flip and restore it back
    after a failure.

Cc: stable@vger.kernel.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index ebe9dae..d6aff15 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7288,8 +7288,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 {
 	struct drm_device *dev = crtc->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_framebuffer *intel_fb;
-	struct drm_i915_gem_object *obj;
+	struct drm_framebuffer *old_fb = crtc->fb;
+	struct drm_i915_gem_object *obj = to_intel_framebuffer(fb)->obj;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct intel_unpin_work *work;
 	unsigned long flags;
@@ -7314,8 +7314,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 
 	work->event = event;
 	work->crtc = crtc;
-	intel_fb = to_intel_framebuffer(crtc->fb);
-	work->old_fb_obj = intel_fb->obj;
+	work->old_fb_obj = to_intel_framebuffer(old_fb)->obj;
 	INIT_WORK(&work->work, intel_unpin_work_fn);
 
 	ret = drm_vblank_get(dev, intel_crtc->pipe);
@@ -7335,9 +7334,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 	intel_crtc->unpin_work = work;
 	spin_unlock_irqrestore(&dev->event_lock, flags);
 
-	intel_fb = to_intel_framebuffer(fb);
-	obj = intel_fb->obj;
-
 	if (atomic_read(&intel_crtc->unpin_work_count) >= 2)
 		flush_workqueue(dev_priv->wq);
 
@@ -7372,6 +7368,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
 
 cleanup_pending:
 	atomic_dec(&intel_crtc->unpin_work_count);
+	crtc->fb = old_fb;
 	drm_gem_object_unreference(&work->old_fb_obj->base);
 	drm_gem_object_unreference(&obj->base);
 	mutex_unlock(&dev->struct_mutex);
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH v2] drm/i915: Don't clobber crtc->fb when queue_flip fails
  2013-02-22 14:53 [PATCH v2] drm/i915: Don't clobber crtc->fb when queue_flip fails ville.syrjala
@ 2013-02-22 15:13 ` Chris Wilson
  2013-03-03 18:52   ` Daniel Vetter
  2013-02-25 13:25 ` Mika Kuoppala
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2013-02-22 15:13 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx, stable

On Fri, Feb 22, 2013 at 04:53:38PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Restore crtc->fb to the old framebuffer if queue_flip fails.
> 
> While at it, kill the pointless intel_fb temp variable.
> 
> v2: Update crtc->fb before queue_flip and restore it back
>     after a failure.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Lgtm, either v1 or v2 gets my
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
(with a slight preference towards v2 for the sake of paranoia)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH v2] drm/i915: Don't clobber crtc->fb when queue_flip fails
  2013-02-22 14:53 [PATCH v2] drm/i915: Don't clobber crtc->fb when queue_flip fails ville.syrjala
  2013-02-22 15:13 ` [Intel-gfx] " Chris Wilson
@ 2013-02-25 13:25 ` Mika Kuoppala
  1 sibling, 0 replies; 5+ messages in thread
From: Mika Kuoppala @ 2013-02-25 13:25 UTC (permalink / raw)
  To: ville.syrjala, intel-gfx; +Cc: stable

ville.syrjala@linux.intel.com writes:

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Restore crtc->fb to the old framebuffer if queue_flip fails.
>
> While at it, kill the pointless intel_fb temp variable.
>
> v2: Update crtc->fb before queue_flip and restore it back
>     after a failure.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Tested-by: Mika Kuoppala <mika.kuoppala@intel.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH v2] drm/i915: Don't clobber crtc->fb when queue_flip fails
  2013-02-22 15:13 ` [Intel-gfx] " Chris Wilson
@ 2013-03-03 18:52   ` Daniel Vetter
  2013-03-04 12:47     ` Ville Syrjälä
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2013-03-03 18:52 UTC (permalink / raw)
  To: Chris Wilson, ville.syrjala, intel-gfx, stable

On Fri, Feb 22, 2013 at 03:13:00PM +0000, Chris Wilson wrote:
> On Fri, Feb 22, 2013 at 04:53:38PM +0200, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Restore crtc->fb to the old framebuffer if queue_flip fails.
> > 
> > While at it, kill the pointless intel_fb temp variable.
> > 
> > v2: Update crtc->fb before queue_flip and restore it back
> >     after a failure.
> > 
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Lgtm, either v1 or v2 gets my
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> (with a slight preference towards v2 for the sake of paranoia)

Picked up for -fixes, thanks for the patch. And can I wish for an i-g-t
for this?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Intel-gfx] [PATCH v2] drm/i915: Don't clobber crtc->fb when queue_flip fails
  2013-03-03 18:52   ` Daniel Vetter
@ 2013-03-04 12:47     ` Ville Syrjälä
  0 siblings, 0 replies; 5+ messages in thread
From: Ville Syrjälä @ 2013-03-04 12:47 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Chris Wilson, intel-gfx, stable

On Sun, Mar 03, 2013 at 07:52:33PM +0100, Daniel Vetter wrote:
> On Fri, Feb 22, 2013 at 03:13:00PM +0000, Chris Wilson wrote:
> > On Fri, Feb 22, 2013 at 04:53:38PM +0200, ville.syrjala@linux.intel.com wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Restore crtc->fb to the old framebuffer if queue_flip fails.
> > > 
> > > While at it, kill the pointless intel_fb temp variable.
> > > 
> > > v2: Update crtc->fb before queue_flip and restore it back
> > >     after a failure.
> > > 
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Lgtm, either v1 or v2 gets my
> > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> > (with a slight preference towards v2 for the sake of paranoia)
> 
> Picked up for -fixes, thanks for the patch. And can I wish for an i-g-t
> for this?

Hmm. I think it's a bit difficult to hit it systematically due to a
GPU reset. We need to call queue_flip after a hang was detected but
before the reset work has a chance to run.

But after a bit more though we should hit the same bug by trying to
flip to a Y-tiled buffer. I'll try to make a test based on that.

-- 
Ville Syrjälä
Intel OTC

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-04 12:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-22 14:53 [PATCH v2] drm/i915: Don't clobber crtc->fb when queue_flip fails ville.syrjala
2013-02-22 15:13 ` [Intel-gfx] " Chris Wilson
2013-03-03 18:52   ` Daniel Vetter
2013-03-04 12:47     ` Ville Syrjälä
2013-02-25 13:25 ` Mika Kuoppala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).