diff mbox

drm/i915: Skip GPU wait for scanout pin while wedged

Message ID 1311118003-3443-1-git-send-email-keithp@keithp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Keith Packard July 19, 2011, 11:26 p.m. UTC
Failing to pin a scanout buffer will most likely lead to a black
screen, so if the GPU is wedged, then just let the pin happen and hope
that things work out OK.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 drivers/gpu/drm/i915/i915_gem.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

Comments

Chris Wilson July 20, 2011, 12:03 a.m. UTC | #1
On Tue, 19 Jul 2011 16:26:43 -0700, Keith Packard <keithp@keithp.com> wrote:
> Failing to pin a scanout buffer will most likely lead to a black
> screen, so if the GPU is wedged, then just let the pin happen and hope
> that things work out OK.

This doesn't prevent us returning an error should the wait-rendering abort
due to a GPU hang occurring in the middle of the wait.

i915_gem_object_pin_to_display_plane is used for more than just the
scanout, cursors and overlay are also included, otherwise we could just
ignore any errors. So,

/* Update the display engine regardless of any GPU hangs */
if (ret == -ERESTARTSYS)
	return ret;

-Chris
Keith Packard July 20, 2011, 12:22 a.m. UTC | #2
On Wed, 20 Jul 2011 01:03:17 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:

> This doesn't prevent us returning an error should the wait-rendering abort
> due to a GPU hang occurring in the middle of the wait.

Yeah, should probably check the return value and ignore the error instead.

> i915_gem_object_pin_to_display_plane is used for more than just the
> scanout, cursors and overlay are also included, otherwise we could just
> ignore any errors. So,

Given that the GPU is wedged, I don't see any problem pinning any of
these instead of failing.

> /* Update the display engine regardless of any GPU hangs */
> if (ret == -ERESTARTSYS)
> 	return ret;

Yeah, that seems simpler in all ways. Much nicer.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index e9d1d5c..d8d623e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3112,9 +3112,15 @@  i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
 		return ret;
 
 	if (pipelined != obj->ring) {
-		ret = i915_gem_object_wait_rendering(obj);
-		if (ret)
-			return ret;
+		struct drm_device *dev = obj->base.dev;
+		drm_i915_private_t *dev_priv = dev->dev_private;
+		if (atomic_read(&dev_priv->mm.wedged)) {
+			DRM_ERROR("Skip GPU wait for scanout while wedged\n");
+		} else {
+			ret = i915_gem_object_wait_rendering(obj);
+			if (ret)
+				return ret;
+		}
 	}
 
 	/* The display engine is not coherent with the LLC cache on gen6.  As