summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-08-20 21:23:20 +0200
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-08 10:13:28 +0100
commitc911fc1c6ad61b56869ee521f1a477c741b039da (patch)
tree4e6ac0096e85ce04c44fe86ad497f531d8792981
parent67e77c5ae8bff6f805d207541f1315051248a87b (diff)
downloadlwn-c911fc1c6ad61b56869ee521f1a477c741b039da.tar.gz
lwn-c911fc1c6ad61b56869ee521f1a477c741b039da.zip
drm/i915: unload: ensure that gem is idle
When the module unloads, all users should be gone, hence all bo references held by userspace, too. This should already result in an idle ringbuffer. Still, be paranoid and idle gem before starting the unload dance. Also kill the call to i915_gem_lastclose under an if (kms), it's a noop for kms. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 27a826e3170a..14133ebef33b 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -2249,11 +2249,18 @@ free_priv:
int i915_driver_unload(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
+ int ret;
spin_lock(&mchdev_lock);
i915_mch_dev = NULL;
spin_unlock(&mchdev_lock);
+ mutex_lock(&dev->struct_mutex);
+ ret = i915_gpu_idle(dev);
+ if (ret)
+ DRM_ERROR("failed to idle hardware: %d\n", ret);
+ mutex_unlock(&dev->struct_mutex);
+
io_mapping_free(dev_priv->mm.gtt_mapping);
if (dev_priv->mm.gtt_mtrr >= 0) {
mtrr_del(dev_priv->mm.gtt_mtrr, dev->agp->base,
@@ -2303,7 +2310,6 @@ int i915_driver_unload(struct drm_device *dev)
if (I915_HAS_FBC(dev) && i915_powersave)
i915_cleanup_compression(dev);
drm_mm_takedown(&dev_priv->vram);
- i915_gem_lastclose(dev);
intel_cleanup_overlay(dev);
}