summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2010-04-16 16:33:34 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2010-04-16 16:33:34 +0000
commit3ec81e839bf10baca9ae7d05ebdb734091b8a554 (patch)
tree63f190a8c1c52bb17fbe1a53320086cec9e4a502 /sys/dev
parent61212aa559424334a5ce402674ffb78155753f21 (diff)
Additional gtt alignment paranoia:
when we go to pin, additionally check alignment against that required for tiling and unbind/rebind if needed. We shouldn't hit this case, but it is a good to check (would have found the bug in the last commit). tested by mlarkin and matthieu (and myself, of course)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/i915_drv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/i915_drv.c b/sys/dev/pci/drm/i915_drv.c
index 21db523a421..2abcda9d60c 100644
--- a/sys/dev/pci/drm/i915_drv.c
+++ b/sys/dev/pci/drm/i915_drv.c
@@ -3170,9 +3170,11 @@ i915_gem_object_pin(struct drm_obj *obj, uint32_t alignment, int needs_fence)
* otherwise, so just fail the pin (with a printf so we can fix a
* wrong userland).
*/
- if ((alignment && obj_priv->dmamap != NULL &&
- obj_priv->gtt_offset & (alignment - 1)) || (needs_fence &&
- !i915_gem_object_fence_offset_ok(obj, obj_priv->tiling_mode))) {
+ if (obj_priv->dmamap != NULL &&
+ ((alignment && obj_priv->gtt_offset & (alignment - 1)) ||
+ obj_priv->gtt_offset & (i915_gem_get_gtt_alignment(obj) - 1) ||
+ (needs_fence && !i915_gem_object_fence_offset_ok(obj,
+ obj_priv->tiling_mode)))) {
if (obj_priv->pin_count == 0) {
ret = i915_gem_object_unbind(obj, 1);
if (ret)