From: Mika Kuoppala Date: Tue, 17 Jan 2017 15:59:05 +0000 (+0200) Subject: drm/i915: Tidy up engine reset logic X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=61da536204ca0de24f8fc725c8297019f1e4963d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/i915: Tidy up engine reset logic Split engine reset for engine and request specific parts. Cc: Chris Wilson Cc: Tvrtko Ursulin Signed-off-by: Mika Kuoppala Link: http://patchwork.freedesktop.org/patch/msgid/1484668747-9120-5-git-send-email-mika.kuoppala@intel.com Reviewed-by: Chris Wilson Signed-off-by: Chris Wilson --- diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index e2a6f482b80f..832ad092f462 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2679,10 +2679,26 @@ static void engine_skip_context(struct drm_i915_gem_request *request) spin_unlock_irqrestore(&engine->timeline->lock, flags); } +/* Returns true if the request was guilty of hang */ +static bool i915_gem_reset_request(struct drm_i915_gem_request *request) +{ + /* Read once and return the resolution */ + const bool guilty = engine_stalled(request->engine); + + if (guilty) { + i915_gem_context_mark_guilty(request->ctx); + skip_request(request); + } else { + i915_gem_context_mark_innocent(request->ctx); + dma_fence_set_error(&request->fence, -EAGAIN); + } + + return guilty; +} + static void i915_gem_reset_engine(struct intel_engine_cs *engine) { struct drm_i915_gem_request *request; - struct i915_gem_context *hung_ctx; if (engine->irq_seqno_barrier) engine->irq_seqno_barrier(engine); @@ -2691,16 +2707,8 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine) if (!request) return; - hung_ctx = request->ctx; - - if (engine_stalled(engine)) { - i915_gem_context_mark_guilty(hung_ctx); - skip_request(request); - } else { - i915_gem_context_mark_innocent(hung_ctx); - dma_fence_set_error(&request->fence, -EAGAIN); + if (!i915_gem_reset_request(request)) return; - } DRM_DEBUG_DRIVER("resetting %s to restart from tail of request 0x%x\n", engine->name, request->global_seqno); @@ -2709,7 +2717,7 @@ static void i915_gem_reset_engine(struct intel_engine_cs *engine) engine->reset_hw(engine, request); /* If this context is now banned, skip all of its pending requests. */ - if (i915_gem_context_is_banned(hung_ctx)) + if (i915_gem_context_is_banned(request->ctx)) engine_skip_context(request); }