[RFC 8/8] drm/i915/svm: VM_BIND for endless batch buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>
Cc: Jon Bloomfield <jon.bloomfield@xxxxxxxxx>
Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx>
Cc: Chris P Wilson <chris.p.wilson@xxxxxxxxx>
Cc: Sudeep Dutt <sudeep.dutt@xxxxxxxxx>
Cc: Stuart Summers <stuart.summers@xxxxxxxxx>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@xxxxxxxxx>
---
 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
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux