summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm2/i915/i915_gem_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/drm2/i915/i915_gem_context.c')
-rw-r--r--sys/dev/drm2/i915/i915_gem_context.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/drm2/i915/i915_gem_context.c b/sys/dev/drm2/i915/i915_gem_context.c
index 5ab9af1..4a94c28 100644
--- a/sys/dev/drm2/i915/i915_gem_context.c
+++ b/sys/dev/drm2/i915/i915_gem_context.c
@@ -297,6 +297,14 @@ void i915_gem_context_fini(struct drm_device *dev)
i915_gem_object_unpin(dev_priv->ring[RCS].default_context->obj);
+ /* When default context is created and switched to, base object refcount
+ * will be 2 (+1 from object creation and +1 from do_switch()).
+ * i915_gem_context_fini() will be called after gpu_idle() has switched
+ * to default context. So we need to unreference the base object once
+ * to offset the do_switch part, so that i915_gem_context_unreference()
+ * can then free the base object correctly. */
+ drm_gem_object_unreference(&dev_priv->ring[RCS].default_context->obj->base);
+
do_destroy(dev_priv->ring[RCS].default_context);
}
OpenPOWER on IntegriCloud