Commit 07e19ea4 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Assert that the partial VMA fits within the object

When creating a partial VMA assert that it first fits with the parent
object, and that if it covers the whole of the parent a normal view was
created instead.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161223145804.6605-5-chris@chris-wilson.co.uk
parent 8bfc478f
...@@ -95,8 +95,13 @@ __i915_vma_create(struct drm_i915_gem_object *obj, ...@@ -95,8 +95,13 @@ __i915_vma_create(struct drm_i915_gem_object *obj,
if (view) { if (view) {
vma->ggtt_view = *view; vma->ggtt_view = *view;
if (view->type == I915_GGTT_VIEW_PARTIAL) { if (view->type == I915_GGTT_VIEW_PARTIAL) {
GEM_BUG_ON(range_overflows_t(u64,
view->params.partial.offset,
view->params.partial.size,
obj->base.size >> PAGE_SHIFT));
vma->size = view->params.partial.size; vma->size = view->params.partial.size;
vma->size <<= PAGE_SHIFT; vma->size <<= PAGE_SHIFT;
GEM_BUG_ON(vma->size >= obj->base.size);
} else if (view->type == I915_GGTT_VIEW_ROTATED) { } else if (view->type == I915_GGTT_VIEW_ROTATED) {
vma->size = vma->size =
intel_rotation_info_size(&view->params.rotated); intel_rotation_info_size(&view->params.rotated);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment