[Intel-gfx] [PATCH 072/190] drm/i915: Execlists cannot pin a context without the object

Chris Wilson chris at chris-wilson.co.uk
Mon Jan 11 01:17:23 PST 2016


Given that the intel_lr_context_pin cannot succeed without the object,
we cannot reach intel_lr_context_unpin() without first allocating that
object - so we can remove the redundant test.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_lrc.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 84a8bcc90d78..0f0bf97e4032 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -769,17 +769,14 @@ static int intel_lr_context_pin(struct drm_i915_gem_request *rq)
 void intel_lr_context_unpin(struct drm_i915_gem_request *rq)
 {
 	int engine = rq->engine->id;
-	struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[engine].state;
-	struct intel_ring *ring = rq->ring;
-
-	if (ctx_obj) {
-		WARN_ON(!mutex_is_locked(&rq->i915->dev->struct_mutex));
-		if (--rq->ctx->engine[engine].pin_count == 0) {
-			intel_ring_unmap(ring);
-			i915_gem_object_ggtt_unpin(ctx_obj);
-			i915_gem_context_unreference(rq->ctx);
-		}
-	}
+
+	WARN_ON(!mutex_is_locked(&rq->i915->dev->struct_mutex));
+	if (--rq->ctx->engine[engine].pin_count)
+		return;
+
+	intel_ring_unmap(rq->ring);
+	i915_gem_object_ggtt_unpin(rq->ctx->engine[engine].state);
+	i915_gem_context_unreference(rq->ctx);
 }
 
 static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req)
-- 
2.7.0.rc3



More information about the Intel-gfx mailing list