aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <[email protected]>2018-06-25 11:06:04 +0100
committerChris Wilson <[email protected]>2018-06-25 16:28:23 +0100
commitefe79d48a7debf57ad156a43a9215f8b0c9210d4 (patch)
tree38244d6a11bdac5509aaa343a013a44c0f78a973
parentdd12c6ca5b45fd54e80c1424b11a5a25ad913dbb (diff)
drm/i915: Context objects can never be active when freed
Due to how we only release the pining on the context state on retirement and never track activity on the context vma itself, the object can never be active at the point of release. Replace the conditional transfer of ownership onto an active-reference with an assert that the object is idle. Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.c4
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 8f020537a34b..46572976c942 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1344,7 +1344,9 @@ static void execlists_context_destroy(struct intel_context *ce)
return;
intel_ring_free(ce->ring);
- __i915_gem_object_release_unless_active(ce->state->obj);
+
+ GEM_BUG_ON(i915_gem_object_is_active(ce->state->obj));
+ i915_gem_object_put(ce->state->obj);
}
static void execlists_context_unpin(struct intel_context *ce)
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 4dae23885006..d248742b1473 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1167,8 +1167,11 @@ static void intel_ring_context_destroy(struct intel_context *ce)
{
GEM_BUG_ON(ce->pin_count);
- if (ce->state)
- __i915_gem_object_release_unless_active(ce->state->obj);
+ if (!ce->state)
+ return;
+
+ GEM_BUG_ON(i915_gem_object_is_active(ce->state->obj));
+ i915_gem_object_put(ce->state->obj);
}
static int __context_pin_ppgtt(struct i915_gem_context *ctx)