In a nonblocking wait, we gather up all the outstanding requests and then drop the mutex. However if all those requests have already completed we do not need to wait upon them and can exit early without having to drop and reacquire the struct_mutex. Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_gem.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index a7cad2c7c034..d452499ae5a9 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1226,7 +1226,10 @@ i915_gem_object_wait_rendering__nonblocking(struct drm_i915_gem_object *obj, if (req == NULL) return 0; - requests[n++] = i915_gem_request_get(req); + if (i915_gem_request_completed(req)) + i915_gem_request_retire_upto(req); + else + requests[n++] = i915_gem_request_get(req); } else { for (i = 0; i < I915_NUM_RINGS; i++) { struct drm_i915_gem_request *req; @@ -1235,10 +1238,16 @@ i915_gem_object_wait_rendering__nonblocking(struct drm_i915_gem_object *obj, if (req == NULL) continue; - requests[n++] = i915_gem_request_get(req); + if (i915_gem_request_completed(req)) + i915_gem_request_retire_upto(req); + else + requests[n++] = i915_gem_request_get(req); } } + if (n == 0) + return 0; + mutex_unlock(&dev->struct_mutex); ret = 0; for (i = 0; ret == 0 && i < n; i++) -- 2.7.0.rc3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx