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

Niranjana Vishwanathapura niranjana.vishwanathapura at intel.com
Fri Jan 24 08:54:02 UTC 2020


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

Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Cc: Jon Bloomfield <jon.bloomfield at intel.com>
Cc: Daniel Vetter <daniel.vetter at intel.com>
Cc: Chris P Wilson <chris.p.wilson at intel.com>
Cc: Sudeep Dutt <sudeep.dutt at intel.com>
Cc: Stuart Summers <stuart.summers at intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
---
 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



More information about the Intel-gfx mailing list