drm/i915: i915_gem_object_finish_gtt must always release gtt mmap
authorKeith Packard <keithp@keithp.com>
Sat, 25 Jun 2011 04:02:59 +0000 (21:02 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 25 Jun 2011 04:02:59 +0000 (21:02 -0700)
Even if the object is no longer in the GTT domain, there may still be
a user space mapping which needs to be released.

Without this fix, render-based text (mostly in firefox) would
occasionally get corrupted when the system was under load.

Signed-off-by: Keith Packard <keithp@keithp.com>
drivers/gpu/drm/i915/i915_gem.c

index b29e0f2b780af5c62ea804761b2160db71f86c9f..6026817372da0cb024504f4af7a95ed4585cff1b 100644 (file)
@@ -2155,15 +2155,15 @@ static void i915_gem_object_finish_gtt(struct drm_i915_gem_object *obj)
 {
        u32 old_write_domain, old_read_domains;
 
-       if ((obj->base.read_domains & I915_GEM_DOMAIN_GTT) == 0)
-               return;
-
        /* Act a barrier for all accesses through the GTT */
        mb();
 
        /* Force a pagefault for domain tracking on next user access */
        i915_gem_release_mmap(obj);
 
+       if ((obj->base.read_domains & I915_GEM_DOMAIN_GTT) == 0)
+               return;
+
        old_read_domains = obj->base.read_domains;
        old_write_domain = obj->base.write_domain;