drm/i915: Disable pwrctx before unpin and free
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 11 Nov 2009 17:19:18 +0000 (12:19 -0500)
committerEric Anholt <eric@anholt.net>
Tue, 1 Dec 2009 00:27:23 +0000 (16:27 -0800)
Otherwise the chip may scribble over free memory.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/intel_display.c

index abd24e2a49328e02ecf6205ef944b996bb7f4865..d2519f0136efe92627d8f376afad3657c8db253f 100644 (file)
@@ -4588,6 +4588,11 @@ void intel_modeset_cleanup(struct drm_device *dev)
                dev_priv->display.disable_fbc(dev);
 
        if (dev_priv->pwrctx) {
+               struct drm_i915_gem_object *obj_priv;
+
+               obj_priv = dev_priv->pwrctx->driver_private;
+               I915_WRITE(PWRCTXA, obj_priv->gtt_offset &~ PWRCTX_EN);
+               I915_READ(PWRCTXA);
                i915_gem_object_unpin(dev_priv->pwrctx);
                drm_gem_object_unreference(dev_priv->pwrctx);
        }