aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-11-15 00:25:58 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2010-11-15 01:48:46 -0500
commitdf15315899c0641412bd54b29565a70b078a6ac8 (patch)
treec7204b201c929055f2d8b28fdabe0ddf191d3841
parent5e78330126e23e009502b21d1efdabd68ab91397 (diff)
drm/i915: Fix current tiling check for relaxed fencing
As we may bind an object with the correct alignment, but with an invalid size, it may pass the current checks on whether the object may be reused with a fence. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--drivers/gpu/drm/i915/i915_gem_tiling.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c
index 0597a737ebad..a517b48d441d 100644
--- a/drivers/gpu/drm/i915/i915_gem_tiling.c
+++ b/drivers/gpu/drm/i915/i915_gem_tiling.c
@@ -245,6 +245,17 @@ i915_gem_object_fence_ok(struct drm_gem_object *obj, int tiling_mode)
245 if (INTEL_INFO(obj->dev)->gen >= 4) 245 if (INTEL_INFO(obj->dev)->gen >= 4)
246 return true; 246 return true;
247 247
248 if (!obj_priv->gtt_space)
249 return true;
250
251 if (INTEL_INFO(obj->dev)->gen == 3) {
252 if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK)
253 return false;
254 } else {
255 if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK)
256 return false;
257 }
258
248 /* 259 /*
249 * Previous chips need to be aligned to the size of the smallest 260 * Previous chips need to be aligned to the size of the smallest
250 * fence register that can contain the object. 261 * fence register that can contain the object.
@@ -257,16 +268,11 @@ i915_gem_object_fence_ok(struct drm_gem_object *obj, int tiling_mode)
257 while (size < obj_priv->base.size) 268 while (size < obj_priv->base.size)
258 size <<= 1; 269 size <<= 1;
259 270
260 if (obj_priv->gtt_offset & (size - 1)) 271 if (obj_priv->gtt_space->size != size)
261 return false; 272 return false;
262 273
263 if (INTEL_INFO(obj->dev)->gen == 3) { 274 if (obj_priv->gtt_offset & (size - 1))
264 if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK) 275 return false;
265 return false;
266 } else {
267 if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK)
268 return false;
269 }
270 276
271 return true; 277 return true;
272} 278}