[Intel-gfx] [PATCH 13/37] drm/i915: Unbind bo if currently bound with incorrect alignment.
Chris Wilson
chris at chris-wilson.co.uk
Wed Mar 10 23:45:00 CET 2010
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++
drivers/gpu/drm/i915/intel_fb.c | 6 ++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3904d43..e1f4874 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -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? */
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index aaabbcb..89717e3 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -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);
--
1.7.0
More information about the Intel-gfx
mailing list