Initial attempt at supporting VM_BIND for  endless batch buffer.
Not tested.

Cc: Joonas Lahtinen <[email protected]>
Cc: Jon Bloomfield <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Chris P Wilson <[email protected]>
Cc: Sudeep Dutt <[email protected]>
Cc: Stuart Summers <[email protected]>
Signed-off-by: Niranjana Vishwanathapura <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gem_svm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_svm.c 
b/drivers/gpu/drm/i915/gem/i915_gem_svm.c
index e5e45ccc4262..dd12c2c46aa8 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_svm.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_svm.c
@@ -68,9 +68,20 @@ int i915_gem_vm_bind_svm_obj(struct i915_address_space *vm,
                 * and we don't need to store va_start.
                 */
                mutex_lock(&vm->svm_mutex);
+               if (i915_vm_is_active(vm)) {
+                       u64 pin_flags = vma->va_start |
+                                       PIN_OFFSET_FIXED | PIN_USER;
+
+                       ret = i915_vma_pin(vma, 0, 0, pin_flags);
+                       if (ret) {
+                               mutex_unlock(&vm->mutex);
+                               goto put_obj;
+                       }
+               }
                list_add(&vma->svm_link, &vm->svm_list);
                mutex_unlock(&vm->svm_mutex);
        } else {
+               /* FIXME: Do async unbind if vm is active */
                vma = i915_gem_vm_lookup_svm_vma(vm, obj, va);
                if (vma) {
                        __i915_vma_unpin(vma);
-- 
2.21.0.rc0.32.g243a4c7e27

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to