/* 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)
/* 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)) {
		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;
	}
	if (obj->size & (obj->size - 1))
		return false;
	if (obj_priv->gtt_offset & (obj->size - 1))
		return false;
	return true;
}