diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-10-31 09:53:52 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-11-07 12:42:00 -0500 |
commit | ef79e17ccef32599f3cec3842f81d70117181291 (patch) | |
tree | ad5235159d6cde022160a2e09e318c8a7608778c /drivers/gpu/drm/i915/i915_gem.c | |
parent | 9362c7c576d39ebca81f82e931ab109c065d42be (diff) |
drm/i915: Only mark as map-and-fenceable when bound into the GGTT
We use the obj->map_and_fenceable hint for when we already have a
valid mapping of this object in the aperture. This hint can only apply
to the GGTT and not to the aliasing-ppGTT. One user of the hint is
execbuffer relocation, which began to fail when it tried to follow the
hint and perform the relocate through the non-existent GGTT mapping.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85671
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index c2456c2be732..0c6ef667d256 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -3476,20 +3476,6 @@ search_free: | |||
3476 | list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); | 3476 | list_move_tail(&obj->global_list, &dev_priv->mm.bound_list); |
3477 | list_add_tail(&vma->mm_list, &vm->inactive_list); | 3477 | list_add_tail(&vma->mm_list, &vm->inactive_list); |
3478 | 3478 | ||
3479 | if (i915_is_ggtt(vm)) { | ||
3480 | bool mappable, fenceable; | ||
3481 | |||
3482 | fenceable = (vma->node.size == fence_size && | ||
3483 | (vma->node.start & (fence_alignment - 1)) == 0); | ||
3484 | |||
3485 | mappable = (vma->node.start + obj->base.size <= | ||
3486 | dev_priv->gtt.mappable_end); | ||
3487 | |||
3488 | obj->map_and_fenceable = mappable && fenceable; | ||
3489 | } | ||
3490 | |||
3491 | WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable); | ||
3492 | |||
3493 | trace_i915_vma_bind(vma, flags); | 3479 | trace_i915_vma_bind(vma, flags); |
3494 | vma->bind_vma(vma, obj->cache_level, | 3480 | vma->bind_vma(vma, obj->cache_level, |
3495 | flags & (PIN_MAPPABLE | PIN_GLOBAL) ? GLOBAL_BIND : 0); | 3481 | flags & (PIN_MAPPABLE | PIN_GLOBAL) ? GLOBAL_BIND : 0); |
@@ -4061,6 +4047,7 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, | |||
4061 | { | 4047 | { |
4062 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; | 4048 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; |
4063 | struct i915_vma *vma; | 4049 | struct i915_vma *vma; |
4050 | unsigned bound; | ||
4064 | int ret; | 4051 | int ret; |
4065 | 4052 | ||
4066 | if (WARN_ON(vm == &dev_priv->mm.aliasing_ppgtt->base)) | 4053 | if (WARN_ON(vm == &dev_priv->mm.aliasing_ppgtt->base)) |
@@ -4090,6 +4077,7 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, | |||
4090 | } | 4077 | } |
4091 | } | 4078 | } |
4092 | 4079 | ||
4080 | bound = vma ? vma->bound : 0; | ||
4093 | if (vma == NULL || !drm_mm_node_allocated(&vma->node)) { | 4081 | if (vma == NULL || !drm_mm_node_allocated(&vma->node)) { |
4094 | vma = i915_gem_object_bind_to_vm(obj, vm, alignment, flags); | 4082 | vma = i915_gem_object_bind_to_vm(obj, vm, alignment, flags); |
4095 | if (IS_ERR(vma)) | 4083 | if (IS_ERR(vma)) |
@@ -4099,6 +4087,29 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj, | |||
4099 | if (flags & PIN_GLOBAL && !(vma->bound & GLOBAL_BIND)) | 4087 | if (flags & PIN_GLOBAL && !(vma->bound & GLOBAL_BIND)) |
4100 | vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND); | 4088 | vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND); |
4101 | 4089 | ||
4090 | if ((bound ^ vma->bound) & GLOBAL_BIND) { | ||
4091 | bool mappable, fenceable; | ||
4092 | u32 fence_size, fence_alignment; | ||
4093 | |||
4094 | fence_size = i915_gem_get_gtt_size(obj->base.dev, | ||
4095 | obj->base.size, | ||
4096 | obj->tiling_mode); | ||
4097 | fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev, | ||
4098 | obj->base.size, | ||
4099 | obj->tiling_mode, | ||
4100 | true); | ||
4101 | |||
4102 | fenceable = (vma->node.size == fence_size && | ||
4103 | (vma->node.start & (fence_alignment - 1)) == 0); | ||
4104 | |||
4105 | mappable = (vma->node.start + obj->base.size <= | ||
4106 | dev_priv->gtt.mappable_end); | ||
4107 | |||
4108 | obj->map_and_fenceable = mappable && fenceable; | ||
4109 | } | ||
4110 | |||
4111 | WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable); | ||
4112 | |||
4102 | vma->pin_count++; | 4113 | vma->pin_count++; |
4103 | if (flags & PIN_MAPPABLE) | 4114 | if (flags & PIN_MAPPABLE) |
4104 | obj->pin_mappable |= true; | 4115 | obj->pin_mappable |= true; |