From bbee9d92aa99d7445340361a613a892dc4319df5 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 24 Mar 2014 21:15:12 +0000 Subject: [PATCH] drm/i915: Upgrade execbuffer fail after resume failure to EIO If we try to execute on a known ring, but it has failed to be initialised correctly, report that the GPU is hung rather than the command invalid. This leaves us reporting EINVAL only if the user requests execution on a known ring that is not supported by the device. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 1b45163e19f3..97facb5a2648 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -991,6 +991,18 @@ i915_reset_gen7_sol_offsets(struct drm_device *dev, return 0; } +static bool +intel_ring_valid(struct intel_ring_buffer *ring) +{ + switch (ring->id) { + case RCS: return true; + case VCS: return HAS_BSD(ring->dev); + case BCS: return HAS_BLT(ring->dev); + case VECS: return HAS_VEBOX(ring->dev); + default: WARN_ONCE(1, "unknown ring %d\n", ring->id); return false; + } +} + static int i915_gem_do_execbuffer(struct drm_device *dev, void *data, struct drm_file *file, @@ -1041,7 +1053,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, if (!intel_ring_initialized(ring)) { DRM_DEBUG("execbuf with invalid ring: %d\n", (int)(args->flags & I915_EXEC_RING_MASK)); - return -EINVAL; + return intel_ring_valid(ring) ? -EIO : -EINVAL; } mode = args->flags & I915_EXEC_CONSTANTS_MASK; -- 1.9.1