On Fri, Apr 17, 2015 at 05:00:07PM +0300, Joonas Lahtinen wrote: > GGTT VMA sizes might be smaller than the whole object size due to > different GGTT views. > > Signed-off-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/i915_gem.c | 32 +++++++++++++++++++------------- > drivers/gpu/drm/i915/i915_gem_gtt.c | 23 +++++++++++++++++++++++ > drivers/gpu/drm/i915/i915_gem_gtt.h | 4 ++++ > 3 files changed, 46 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index f7b8766..77116bd 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -3507,7 +3507,7 @@ i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj, > { > struct drm_device *dev = obj->base.dev; > struct drm_i915_private *dev_priv = dev->dev_private; > - u32 size, fence_size, fence_alignment, unfenced_alignment; > + u32 size, vma_size, fence_size, fence_alignment, unfenced_alignment; > unsigned long start = > flags & PIN_OFFSET_BIAS ? flags & PIN_OFFSET_MASK : 0; > unsigned long end = > @@ -3518,15 +3518,18 @@ i915_gem_object_bind_to_vm(struct drm_i915_gem_object *obj, > if(WARN_ON(i915_is_ggtt(vm) != !!ggtt_view)) > return ERR_PTR(-EINVAL); > > + size = ggtt_view ? i915_ggtt_view_size(obj, ggtt_view) : > + obj->base.size; > + > fence_size = i915_gem_get_gtt_size(dev, > - obj->base.size, > + size, > obj->tiling_mode); > fence_alignment = i915_gem_get_gtt_alignment(dev, > - obj->base.size, > + size, > obj->tiling_mode, true); > unfenced_alignment = > i915_gem_get_gtt_alignment(dev, > - obj->base.size, > + size, > obj->tiling_mode, false); This is completely wrong. These calculations are purely about the fence representation of the whole object, not of the view. After computing the fence_size etc, you then want to deduce the actual size to bind, based on partial view, fencing, padded or just normal. -Chris -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx