|
@@ -3476,20 +3476,6 @@ search_free:
|
|
list_move_tail(&obj->global_list, &dev_priv->mm.bound_list);
|
|
list_move_tail(&obj->global_list, &dev_priv->mm.bound_list);
|
|
list_add_tail(&vma->mm_list, &vm->inactive_list);
|
|
list_add_tail(&vma->mm_list, &vm->inactive_list);
|
|
|
|
|
|
- if (i915_is_ggtt(vm)) {
|
|
|
|
- bool mappable, fenceable;
|
|
|
|
-
|
|
|
|
- fenceable = (vma->node.size == fence_size &&
|
|
|
|
- (vma->node.start & (fence_alignment - 1)) == 0);
|
|
|
|
-
|
|
|
|
- mappable = (vma->node.start + obj->base.size <=
|
|
|
|
- dev_priv->gtt.mappable_end);
|
|
|
|
-
|
|
|
|
- obj->map_and_fenceable = mappable && fenceable;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable);
|
|
|
|
-
|
|
|
|
trace_i915_vma_bind(vma, flags);
|
|
trace_i915_vma_bind(vma, flags);
|
|
vma->bind_vma(vma, obj->cache_level,
|
|
vma->bind_vma(vma, obj->cache_level,
|
|
flags & (PIN_MAPPABLE | PIN_GLOBAL) ? GLOBAL_BIND : 0);
|
|
flags & (PIN_MAPPABLE | PIN_GLOBAL) ? GLOBAL_BIND : 0);
|
|
@@ -4061,6 +4047,7 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj,
|
|
{
|
|
{
|
|
struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
|
|
struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
|
|
struct i915_vma *vma;
|
|
struct i915_vma *vma;
|
|
|
|
+ unsigned bound;
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
if (WARN_ON(vm == &dev_priv->mm.aliasing_ppgtt->base))
|
|
if (WARN_ON(vm == &dev_priv->mm.aliasing_ppgtt->base))
|
|
@@ -4090,6 +4077,7 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ bound = vma ? vma->bound : 0;
|
|
if (vma == NULL || !drm_mm_node_allocated(&vma->node)) {
|
|
if (vma == NULL || !drm_mm_node_allocated(&vma->node)) {
|
|
vma = i915_gem_object_bind_to_vm(obj, vm, alignment, flags);
|
|
vma = i915_gem_object_bind_to_vm(obj, vm, alignment, flags);
|
|
if (IS_ERR(vma))
|
|
if (IS_ERR(vma))
|
|
@@ -4099,6 +4087,29 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj,
|
|
if (flags & PIN_GLOBAL && !(vma->bound & GLOBAL_BIND))
|
|
if (flags & PIN_GLOBAL && !(vma->bound & GLOBAL_BIND))
|
|
vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND);
|
|
vma->bind_vma(vma, obj->cache_level, GLOBAL_BIND);
|
|
|
|
|
|
|
|
+ if ((bound ^ vma->bound) & GLOBAL_BIND) {
|
|
|
|
+ bool mappable, fenceable;
|
|
|
|
+ u32 fence_size, fence_alignment;
|
|
|
|
+
|
|
|
|
+ fence_size = i915_gem_get_gtt_size(obj->base.dev,
|
|
|
|
+ obj->base.size,
|
|
|
|
+ obj->tiling_mode);
|
|
|
|
+ fence_alignment = i915_gem_get_gtt_alignment(obj->base.dev,
|
|
|
|
+ obj->base.size,
|
|
|
|
+ obj->tiling_mode,
|
|
|
|
+ true);
|
|
|
|
+
|
|
|
|
+ fenceable = (vma->node.size == fence_size &&
|
|
|
|
+ (vma->node.start & (fence_alignment - 1)) == 0);
|
|
|
|
+
|
|
|
|
+ mappable = (vma->node.start + obj->base.size <=
|
|
|
|
+ dev_priv->gtt.mappable_end);
|
|
|
|
+
|
|
|
|
+ obj->map_and_fenceable = mappable && fenceable;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WARN_ON(flags & PIN_MAPPABLE && !obj->map_and_fenceable);
|
|
|
|
+
|
|
vma->pin_count++;
|
|
vma->pin_count++;
|
|
if (flags & PIN_MAPPABLE)
|
|
if (flags & PIN_MAPPABLE)
|
|
obj->pin_mappable |= true;
|
|
obj->pin_mappable |= true;
|