Commit e0705114 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Refactor direct GPU reset from request waiters

Combine the common code for the pair of waiters into a single function.

v2: Rename reset_request to wait_request_check_and_reset
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170223074422.4125-15-chris@chris-wilson.co.ukReviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
parent a49625f9
...@@ -1023,6 +1023,16 @@ bool __i915_spin_request(const struct drm_i915_gem_request *req, ...@@ -1023,6 +1023,16 @@ bool __i915_spin_request(const struct drm_i915_gem_request *req,
return false; return false;
} }
static bool __i915_wait_request_check_and_reset(struct drm_i915_gem_request *request)
{
if (likely(!i915_reset_in_progress(&request->i915->gpu_error)))
return false;
__set_current_state(TASK_RUNNING);
i915_reset(request->i915);
return true;
}
/** /**
* i915_wait_request - wait until execution of request has finished * i915_wait_request - wait until execution of request has finished
* @req: the request to wait upon * @req: the request to wait upon
...@@ -1084,11 +1094,8 @@ long i915_wait_request(struct drm_i915_gem_request *req, ...@@ -1084,11 +1094,8 @@ long i915_wait_request(struct drm_i915_gem_request *req,
break; break;
if (flags & I915_WAIT_LOCKED && if (flags & I915_WAIT_LOCKED &&
i915_reset_in_progress(&req->i915->gpu_error)) { __i915_wait_request_check_and_reset(req))
__set_current_state(TASK_RUNNING);
i915_reset(req->i915);
continue; continue;
}
if (signal_pending_state(state, current)) { if (signal_pending_state(state, current)) {
timeout = -ERESTARTSYS; timeout = -ERESTARTSYS;
...@@ -1158,11 +1165,8 @@ long i915_wait_request(struct drm_i915_gem_request *req, ...@@ -1158,11 +1165,8 @@ long i915_wait_request(struct drm_i915_gem_request *req,
* itself, or indirectly by recovering the GPU). * itself, or indirectly by recovering the GPU).
*/ */
if (flags & I915_WAIT_LOCKED && if (flags & I915_WAIT_LOCKED &&
i915_reset_in_progress(&req->i915->gpu_error)) { __i915_wait_request_check_and_reset(req))
__set_current_state(TASK_RUNNING);
i915_reset(req->i915);
continue; continue;
}
/* Only spin if we know the GPU is processing this request */ /* Only spin if we know the GPU is processing this request */
if (i915_spin_request(req, state, 2)) if (i915_spin_request(req, state, 2))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment