summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@intel.com>2015-12-11 13:51:53 +0200
committerMika Kuoppala <mika.kuoppala@intel.com>2015-12-11 15:09:20 +0200
commit73f3fbf0b4c745c119975573661c24c64e926dec (patch)
tree8b984713d1748498999b305b68a3324e4db99895
parente335e37c10d44d5474c8f3d28255f9328d99ec7d (diff)
drm/i915: Check for per ring state existence in lrc unpin/pin
Move the check for per ring state object into unpin/pin pairs. This removes the extra check in retire requests and paves way for removal for the default context special casing. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 7644c48da4ea..b1063d056fda 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -967,7 +967,7 @@ void intel_execlists_retire_requests(struct intel_engine_cs *ring)
struct drm_i915_gem_object *ctx_obj =
ctx->engine[ring->id].state;
- if (ctx_obj && (ctx != ring->default_context))
+ if (ctx != ring->default_context))
intel_lr_context_unpin(req);
list_del(&req->execlist_link);
i915_gem_request_unreference(req);
@@ -1051,6 +1051,9 @@ static int intel_lr_context_pin(struct drm_i915_gem_request *rq)
struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state;
struct intel_ringbuffer *ringbuf = rq->ringbuf;
+ if (!ctx_obj)
+ return 0;
+
if (rq->ctx->engine[ring->id].pin_count++ == 0) {
ret = intel_lr_context_do_pin(ring, ctx_obj, ringbuf);
if (ret)
@@ -1069,12 +1072,13 @@ void intel_lr_context_unpin(struct drm_i915_gem_request *rq)
struct drm_i915_gem_object *ctx_obj = rq->ctx->engine[ring->id].state;
struct intel_ringbuffer *ringbuf = rq->ringbuf;
- if (ctx_obj) {
- WARN_ON(!mutex_is_locked(&ring->dev->struct_mutex));
- if (--rq->ctx->engine[ring->id].pin_count == 0) {
- intel_unpin_ringbuffer_obj(ringbuf);
- i915_gem_object_ggtt_unpin(ctx_obj);
- }
+ if (!ctx_obj)
+ return;
+
+ WARN_ON(!mutex_is_locked(&ring->dev->struct_mutex));
+ if (--rq->ctx->engine[ring->id].pin_count == 0) {
+ intel_unpin_ringbuffer_obj(ringbuf);
+ i915_gem_object_ggtt_unpin(ctx_obj);
}
}