summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_request.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-02-23 07:44:20 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-02-23 14:51:26 +0000
commite07051142cbcb991e4fedf86afd8f00425dbc89a (patch)
tree82cb3298d576cf21726f67519e051d95474851ff /drivers/gpu/drm/i915/i915_gem_request.c
parenta49625f90662799426dd99daab97559ef620dce1 (diff)
downloadop-kernel-dev-e07051142cbcb991e4fedf86afd8f00425dbc89a.zip
op-kernel-dev-e07051142cbcb991e4fedf86afd8f00425dbc89a.tar.gz
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: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/20170223074422.4125-15-chris@chris-wilson.co.uk Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_request.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_request.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c
index 43904f4..0582bb7 100644
--- a/drivers/gpu/drm/i915/i915_gem_request.c
+++ b/drivers/gpu/drm/i915/i915_gem_request.c
@@ -1023,6 +1023,16 @@ bool __i915_spin_request(const struct drm_i915_gem_request *req,
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
* @req: the request to wait upon
@@ -1084,11 +1094,8 @@ restart:
break;
if (flags & I915_WAIT_LOCKED &&
- i915_reset_in_progress(&req->i915->gpu_error)) {
- __set_current_state(TASK_RUNNING);
- i915_reset(req->i915);
+ __i915_wait_request_check_and_reset(req))
continue;
- }
if (signal_pending_state(state, current)) {
timeout = -ERESTARTSYS;
@@ -1158,11 +1165,8 @@ wakeup:
* itself, or indirectly by recovering the GPU).
*/
if (flags & I915_WAIT_LOCKED &&
- i915_reset_in_progress(&req->i915->gpu_error)) {
- __set_current_state(TASK_RUNNING);
- i915_reset(req->i915);
+ __i915_wait_request_check_and_reset(req))
continue;
- }
/* Only spin if we know the GPU is processing this request */
if (i915_spin_request(req, state, 2))
OpenPOWER on IntegriCloud