@@ -1250,10 +1250,21 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj)
switch (obj_priv->tiling_mode) {
case I915_TILING_NONE:
alignment = 64 * 1024;
+ if (obj_priv->gtt_space &&
+ obj_priv->gtt_offset & (alignment - 1)) {
+ ret = i915_gem_object_unbind (obj);
+ if (ret)
+ return ret;
+ }
break;
case I915_TILING_X:
/* pin() will align the object as required by fence */
alignment = 0;
+ if (!i915_gem_object_fence_offset_ok(obj, I915_TILING_X)) {
+ ret = i915_gem_object_unbind(obj);
+ if (ret)
+ return ret;
+ }
break;
case I915_TILING_Y:
/* FIXME: Is this true? */
@@ -148,6 +148,12 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
mutex_lock(&dev->struct_mutex);
+ if (obj_priv->gtt_space && obj_priv->gtt_offset & (64*1024 - 1)) {
+ ret = i915_gem_object_unbind (fbo);
+ if (ret)
+ goto out_unref;
+ }
+
ret = i915_gem_object_pin(fbo, 64*1024);
if (ret) {
DRM_ERROR("failed to pin fb: %d\n", ret);