drm/i915: Import Linux commit 168f83660211b9e059e3bc0638daaa01e9ea0b71
This makes sure the default context of each ring is cleaned up with the ring itself and fixes a memory leak. Author: Mika Kuoppala <mika.kuoppala@linux.intel.com> Date: Fri May 3 16:29:08 2013 +0300 drm/i915: unreference default context on module unload Before module unload is called, gpu_idle() will switch to default context. This will increment ref count of base object as the default context is 'running' on module unload time. Unreference the drm object so that when context is freed, base object is freed as well. v2: added comment to explain the refcounts (Ben Widawsky) Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Obtained from: Linux
This commit is contained in:
parent
7888d5e754
commit
b1e2503a5c
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user