With abitrary pin flags it makes sense to split out a "please bind
this into global gtt" from the "please allocate in the mappable
range".
Use this unconditionally in our global gtt pin helper since this is
what its callers want. Later patches will drop PIN_MAPPABLE where it's
not strictly needed.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
#define PIN_MAPPABLE 0x1
#define PIN_NONBLOCK 0x2
+#define PIN_GLOBAL 0x4
int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
struct i915_address_space *vm,
uint32_t alignment,
uint32_t alignment,
unsigned flags)
{
- return i915_gem_object_pin(obj, obj_to_ggtt(obj), alignment, flags);
+ return i915_gem_object_pin(obj, obj_to_ggtt(obj), alignment, flags | PIN_GLOBAL);
}
/* i915_gem_context.c */
struct i915_vma *vma;
int ret;
- if (WARN_ON(flags & PIN_MAPPABLE && !i915_is_ggtt(vm)))
+ if (WARN_ON(flags & (PIN_GLOBAL | PIN_MAPPABLE) && !i915_is_ggtt(vm)))
return -EINVAL;
vma = i915_gem_obj_to_vma(obj, vm);
vma = i915_gem_obj_to_vma(obj, vm);
vma->bind_vma(vma, obj->cache_level,
- flags & PIN_MAPPABLE ? GLOBAL_BIND : 0);
+ flags & PIN_GLOBAL ? GLOBAL_BIND : 0);
i915_gem_obj_to_vma(obj, vm)->pin_count++;
if (flags & PIN_MAPPABLE)
flags |= PIN_MAPPABLE;
if (entry->flags & EXEC_OBJECT_NEEDS_GTT)
- flags |= PIN_MAPPABLE;
+ flags |= PIN_GLOBAL;
ret = i915_gem_object_pin(obj, vma->vm, entry->alignment, flags);
if (ret)