]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
drm/i915: reduce some of the duplication of tiling checking
authorOwain Ainsworth <zerooa@googlemail.com>
Thu, 18 Feb 2010 15:33:00 +0000 (15:33 +0000)
committerEric Anholt <eric@anholt.net>
Mon, 22 Feb 2010 16:54:42 +0000 (11:54 -0500)
i915_gem_object_fenceable was mostly just a repeat of the
i915_gem_object_fence_offset_ok, but also checking the size (which was
checkecd when we allowed that BO to be tiled in the first place). So
instead, export the latter function and use it in place.

Signed-Off-By: Owain G. Ainsworth <oga@openbsd.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_tiling.c

index 953ad64e0553f607777609155298e94a7a018f71..40b0da37b1f123027d45c0f0fcaa398e851043a6 100644 (file)
@@ -914,7 +914,8 @@ void i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj);
 void i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj);
 bool i915_tiling_ok(struct drm_device *dev, int stride, int size,
                    int tiling_mode);
-bool i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj);
+bool i915_gem_object_fence_offset_ok(struct drm_gem_object *obj,
+                                    int tiling_mode);
 
 /* i915_gem_debug.c */
 void i915_gem_dump_object(struct drm_gem_object *obj, int len,
index 7b12604a9eb8007b0a1306c30da1eee8d774b8ef..59dcce054d1ee23808259e549f343da63186818e 100644 (file)
@@ -3253,7 +3253,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
                     obj_priv->tiling_mode != I915_TILING_NONE;
 
        /* Check fence reg constraints and rebind if necessary */
-       if (need_fence && !i915_obj_fenceable(dev, obj))
+       if (need_fence && !i915_gem_object_fence_offset_ok(obj,
+           obj_priv->tiling_mode))
                i915_gem_object_unbind(obj);
 
        /* Choose the GTT offset for our buffer and put it there. */
index b0cbe3a62f84997ef2968688c25178c47aaed148..ba247d1f9bc7c781d7867461f1b81886713bf244 100644 (file)
@@ -180,39 +180,6 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
        dev_priv->mm.bit_6_swizzle_y = swizzle_y;
 }
 
-
-/**
- * Returns whether an object is currently fenceable.  If not, it may need
- * to be unbound and have its pitch adjusted.
- */
-bool
-i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj)
-{
-       struct drm_i915_gem_object *obj_priv = obj->driver_private;
-
-       if (IS_I965G(dev)) {
-               /* The 965 can have fences at any page boundary. */
-               if (obj->size & 4095)
-                       return false;
-               return true;
-       } else if (IS_I9XX(dev)) {
-               if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK)
-                       return false;
-       } else {
-               if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK)
-                       return false;
-       }
-
-       /* Power of two sized... */
-       if (obj->size & (obj->size - 1))
-               return false;
-
-       /* Objects must be size aligned as well */
-       if (obj_priv->gtt_offset & (obj->size - 1))
-               return false;
-       return true;
-}
-
 /* Check pitch constriants for all chips & tiling formats */
 bool
 i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
@@ -269,7 +236,7 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
        return true;
 }
 
-static bool
+bool
 i915_gem_object_fence_offset_ok(struct drm_gem_object *obj, int tiling_mode)
 {
        struct drm_device *dev = obj->dev;