drm/i915: simplify swapin/out swizzle checking a bit
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 12 Sep 2011 19:30:02 +0000 (21:30 +0200)
committerKeith Packard <keithp@keithp.com>
Thu, 20 Oct 2011 21:11:18 +0000 (14:11 -0700)
Use the helper function already employed by the pwrite/pread
functions.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_tiling.c

index f0f885f44b870aa0756867ed516a344725616513..d8e0c15c874f4fbbbdc1cec977eb1aa13b00c234 100644 (file)
@@ -1476,7 +1476,7 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj,
                obj->pages[i] = page;
        }
 
-       if (obj->tiling_mode != I915_TILING_NONE)
+       if (i915_gem_object_needs_bit17_swizzle(obj))
                i915_gem_object_do_bit_17_swizzle(obj);
 
        return 0;
@@ -1498,7 +1498,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
 
        BUG_ON(obj->madv == __I915_MADV_PURGED);
 
-       if (obj->tiling_mode != I915_TILING_NONE)
+       if (i915_gem_object_needs_bit17_swizzle(obj))
                i915_gem_object_save_bit_17_swizzle(obj);
 
        if (obj->madv == I915_MADV_DONTNEED)
index 103da6f2d03bf05a6900e47fc876de7ef8b25c65..31d334d9d9da8a3b78ef9edb8023d5c0ea6c47f3 100644 (file)
@@ -443,14 +443,9 @@ i915_gem_swizzle_page(struct page *page)
 void
 i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj)
 {
-       struct drm_device *dev = obj->base.dev;
-       drm_i915_private_t *dev_priv = dev->dev_private;
        int page_count = obj->base.size >> PAGE_SHIFT;
        int i;
 
-       if (dev_priv->mm.bit_6_swizzle_x != I915_BIT_6_SWIZZLE_9_10_17)
-               return;
-
        if (obj->bit_17 == NULL)
                return;
 
@@ -467,14 +462,9 @@ i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj)
 void
 i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj)
 {
-       struct drm_device *dev = obj->base.dev;
-       drm_i915_private_t *dev_priv = dev->dev_private;
        int page_count = obj->base.size >> PAGE_SHIFT;
        int i;
 
-       if (dev_priv->mm.bit_6_swizzle_x != I915_BIT_6_SWIZZLE_9_10_17)
-               return;
-
        if (obj->bit_17 == NULL) {
                obj->bit_17 = kmalloc(BITS_TO_LONGS(page_count) *
                                           sizeof(long), GFP_KERNEL);