summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_vma.h
diff options
context:
space:
mode:
authorChris Wilson2017-01-11 22:09:26 +0100
committerChris Wilson2017-01-13 17:35:27 +0100
commit0325701a34f96ecc2502228d07f046d479b8d328 (patch)
treeb7d21c8699a0c446975e0ed0a9b425913ccf7c05 /drivers/gpu/drm/i915/i915_vma.h
parentdrm/i915: Move i915_ppgtt_close() into i915_gem_gtt.c (diff)
downloadkernel-qcow2-linux-0325701a34f96ecc2502228d07f046d479b8d328.tar.gz
kernel-qcow2-linux-0325701a34f96ecc2502228d07f046d479b8d328.tar.xz
kernel-qcow2-linux-0325701a34f96ecc2502228d07f046d479b8d328.zip
drm/i915: Assert that we have allocated the drm_mm_node upon pinning
We currently check after the slow path that the vma is bound correctly, but we don't currently check after the fast path. This is important in case we accidentally take the fast path and leave the vma misplaced. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/20170111210937.29252-27-chris@chris-wilson.co.uk Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_vma.h')
-rw-r--r--drivers/gpu/drm/i915/i915_vma.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
index a969bbb65871..008cf115f38f 100644
--- a/drivers/gpu/drm/i915/i915_vma.h
+++ b/drivers/gpu/drm/i915/i915_vma.h
@@ -232,8 +232,11 @@ i915_vma_pin(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
/* Pin early to prevent the shrinker/eviction logic from destroying
* our vma as we insert and bind.
*/
- if (likely(((++vma->flags ^ flags) & I915_VMA_BIND_MASK) == 0))
+ if (likely(((++vma->flags ^ flags) & I915_VMA_BIND_MASK) == 0)) {
+ GEM_BUG_ON(!drm_mm_node_allocated(&vma->node));
+ GEM_BUG_ON(i915_vma_misplaced(vma, size, alignment, flags));
return 0;
+ }
return __i915_vma_do_pin(vma, size, alignment, flags);
}