All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes
@ 2013-02-18 17:08 ville.syrjala
  2013-02-18 17:08 ` [PATCH v2 1/2] drm/i915: Really wait for pending flips when panning ville.syrjala
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: ville.syrjala @ 2013-02-18 17:08 UTC (permalink / raw)
  To: intel-gfx

Here are the (hopefully) final versions of the page flip vs. GPU reset fixes.

They survive the i-g-t kms_flip flip-vs-modeset-vs-hang and
flip-vs-panning-vs-hang tests, as well as stopping the rings while a
fullscreen GL application is running under X.

Now that we finish the page flips explicitly, the patches should also work
on Gen2-Gen4 hardware, assuming we have otherwise working GPU reset support
for them.

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

* [PATCH v2 1/2] drm/i915: Really wait for pending flips when panning
  2013-02-18 17:08 [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes ville.syrjala
@ 2013-02-18 17:08 ` ville.syrjala
  2013-02-18 17:08 ` [PATCH v3 2/2] drm/i915: Finish page flips and update primary planes after a GPU reset ville.syrjala
  2013-02-19  9:07 ` [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes Chris Wilson
  2 siblings, 0 replies; 5+ messages in thread
From: ville.syrjala @ 2013-02-18 17:08 UTC (permalink / raw)
  To: intel-gfx

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

Since obj->pending_flips was never set, intel_pipe_set_base() never
actually waited for pending page flips to complete.

We really do want to wait for the pending flips, because otherwise the
mmio surface base address update could overtake the flip, and you
could end up with an old frame on the screen once the flip really
completes.

Just call intel_crtc_wait_pending_flips() prior to calling
intel_pipe_set_base() instead of calling just intel_finish_fb()
from intel_pipe_set_base(). Moving the call outside of
intel_pipe_set_base() avoids calling it twice from the full
modeset path.

v2: Wait for pending flips w/o holding struct_mutex

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6337196..fd37d8b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2301,9 +2301,6 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 		return ret;
 	}
 
-	if (crtc->fb)
-		intel_finish_fb(crtc->fb);
-
 	ret = dev_priv->display.update_plane(crtc, fb, x, y);
 	if (ret) {
 		intel_unpin_fb_obj(to_intel_framebuffer(fb)->obj);
@@ -8111,6 +8108,8 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
 			goto fail;
 		}
 	} else if (config->fb_changed) {
+		intel_crtc_wait_for_pending_flips(set->crtc);
+
 		ret = intel_pipe_set_base(set->crtc,
 					  set->x, set->y, set->fb);
 	}
-- 
1.7.12.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH v3 2/2] drm/i915: Finish page flips and update primary planes after a GPU reset
  2013-02-18 17:08 [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes ville.syrjala
  2013-02-18 17:08 ` [PATCH v2 1/2] drm/i915: Really wait for pending flips when panning ville.syrjala
@ 2013-02-18 17:08 ` ville.syrjala
  2013-02-19  9:07 ` [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes Chris Wilson
  2 siblings, 0 replies; 5+ messages in thread
From: ville.syrjala @ 2013-02-18 17:08 UTC (permalink / raw)
  To: intel-gfx

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

GPU reset will drop all flips that are still in the ring. So after the
reset, call update_plane() for all CRTCs to make sure the primary
planes are scanning out from the correct buffer.

Also finish all pending flips. That means user space will get its
page flip events and won't get stuck waiting for them.

v2: Explicitly finish page flips instead of relying on FLIP_DONE
    interrupt being generated by the base address update.
v3: Make two loops over crtcs to avoid deadlocks with the crtc mutex

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c      |  2 ++
 drivers/gpu/drm/i915/intel_display.c | 37 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  2 ++
 3 files changed, 41 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 2cd97d1..9fde49a 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -915,6 +915,8 @@ static void i915_error_work_func(struct work_struct *work)
 		for_each_ring(ring, dev_priv, i)
 			wake_up_all(&ring->irq_queue);
 
+		intel_display_handle_reset(dev);
+
 		wake_up_all(&dev_priv->gpu_error.reset_queue);
 	}
 }
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fd37d8b..892f04b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2218,6 +2218,43 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
 	return dev_priv->display.update_plane(crtc, fb, x, y);
 }
 
+void intel_display_handle_reset(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc;
+
+	/*
+	 * Flips in the rings have been nuked by the reset,
+	 * so complete all pending flips so that user space
+	 * will get its events and not get stuck.
+	 *
+	 * Also update the base address of all primary
+	 * planes to the the last fb to make sure we're
+	 * showing the correct fb after a reset.
+	 *
+	 * Need to make two loops over the crtcs so that we
+	 * don't try to grab a crtc mutex before the
+	 * pending_flip_queue really got woken up.
+	 */
+
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+		enum plane plane = intel_crtc->plane;
+
+		intel_prepare_page_flip(dev, plane);
+		intel_finish_page_flip_plane(dev, plane);
+	}
+
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+		struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+
+		mutex_lock(&crtc->mutex);
+		if (intel_crtc->active)
+			dev_priv->display.update_plane(crtc, crtc->fb, crtc->x, crtc->y);
+		mutex_unlock(&crtc->mutex);
+	}
+}
+
 static int
 intel_finish_fb(struct drm_framebuffer *old_fb)
 {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index d282052..0dc14c2 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -694,4 +694,6 @@ extern bool
 intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
 extern void intel_ddi_fdi_disable(struct drm_crtc *crtc);
 
+extern void intel_display_handle_reset(struct drm_device *dev);
+
 #endif /* __INTEL_DRV_H__ */
-- 
1.7.12.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes
  2013-02-18 17:08 [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes ville.syrjala
  2013-02-18 17:08 ` [PATCH v2 1/2] drm/i915: Really wait for pending flips when panning ville.syrjala
  2013-02-18 17:08 ` [PATCH v3 2/2] drm/i915: Finish page flips and update primary planes after a GPU reset ville.syrjala
@ 2013-02-19  9:07 ` Chris Wilson
  2013-02-19 10:33   ` Daniel Vetter
  2 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2013-02-19  9:07 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx

On Mon, Feb 18, 2013 at 07:08:47PM +0200, ville.syrjala@linux.intel.com wrote:
> Here are the (hopefully) final versions of the page flip vs. GPU reset fixes.
> 
> They survive the i-g-t kms_flip flip-vs-modeset-vs-hang and
> flip-vs-panning-vs-hang tests, as well as stopping the rings while a
> fullscreen GL application is running under X.
> 
> Now that we finish the page flips explicitly, the patches should also work
> on Gen2-Gen4 hardware, assuming we have otherwise working GPU reset support
> for them.

Both Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

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

* Re: [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes
  2013-02-19  9:07 ` [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes Chris Wilson
@ 2013-02-19 10:33   ` Daniel Vetter
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Vetter @ 2013-02-19 10:33 UTC (permalink / raw)
  To: Chris Wilson, ville.syrjala, intel-gfx

On Tue, Feb 19, 2013 at 09:07:21AM +0000, Chris Wilson wrote:
> On Mon, Feb 18, 2013 at 07:08:47PM +0200, ville.syrjala@linux.intel.com wrote:
> > Here are the (hopefully) final versions of the page flip vs. GPU reset fixes.
> > 
> > They survive the i-g-t kms_flip flip-vs-modeset-vs-hang and
> > flip-vs-panning-vs-hang tests, as well as stopping the rings while a
> > fullscreen GL application is running under X.
> > 
> > Now that we finish the page flips explicitly, the patches should also work
> > on Gen2-Gen4 hardware, assuming we have otherwise working GPU reset support
> > for them.
> 
> Both Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Both queued for -next, thanks for the patch.
-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

end of thread, other threads:[~2013-02-19 10:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-18 17:08 [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes ville.syrjala
2013-02-18 17:08 ` [PATCH v2 1/2] drm/i915: Really wait for pending flips when panning ville.syrjala
2013-02-18 17:08 ` [PATCH v3 2/2] drm/i915: Finish page flips and update primary planes after a GPU reset ville.syrjala
2013-02-19  9:07 ` [PATCH 0/2] drm/i915: Page flip vs. GPU reset fixes Chris Wilson
2013-02-19 10:33   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.