summaryrefslogtreecommitdiff
path: root/lib/i915/gem_vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/i915/gem_vm.c')
-rw-r--r--lib/i915/gem_vm.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/lib/i915/gem_vm.c b/lib/i915/gem_vm.c
index 9a022a56..ee3c65d0 100644
--- a/lib/i915/gem_vm.c
+++ b/lib/i915/gem_vm.c
@@ -48,7 +48,7 @@ bool gem_has_vm(int i915)
{
uint32_t vm_id = 0;
- __gem_vm_create(i915, &vm_id);
+ __gem_vm_create(i915, 0, &vm_id);
if (vm_id)
gem_vm_destroy(i915, vm_id);
@@ -67,9 +67,9 @@ void gem_require_vm(int i915)
igt_require(gem_has_vm(i915));
}
-int __gem_vm_create(int i915, uint32_t *vm_id)
+int __gem_vm_create(int i915, uint32_t flags, uint32_t *vm_id)
{
- struct drm_i915_gem_vm_control ctl = {};
+ struct drm_i915_gem_vm_control ctl = { .flags = flags };
int err = 0;
if (igt_ioctl(i915, DRM_IOCTL_I915_GEM_VM_CREATE, &ctl) == 0) {
@@ -88,7 +88,8 @@ int __gem_vm_create(int i915, uint32_t *vm_id)
* @i915: open i915 drm file descriptor
*
* This wraps the VM_CREATE ioctl, which is used to allocate a new
- * address space for use with GEM contexts.
+ * address space for use with GEM contexts, with legacy execbuff
+ * method of binding.
*
* Returns: The id of the allocated address space.
*/
@@ -96,7 +97,27 @@ uint32_t gem_vm_create(int i915)
{
uint32_t vm_id;
- igt_assert_eq(__gem_vm_create(i915, &vm_id), 0);
+ igt_assert_eq(__gem_vm_create(i915, 0, &vm_id), 0);
+ igt_assert(vm_id != 0);
+
+ return vm_id;
+}
+
+/**
+ * gem_vm_create_in_vm_bind_mode:
+ * @i915: open i915 drm file descriptor
+ *
+ * This wraps the VM_CREATE ioctl with I915_VM_CREATE_FLAGS_USE_VM_BIND,
+ * flag which is used to allocate a new address space for use with GEM contexts
+ * with vm_bind mode of binding.
+ *
+ * Returns: The id of the allocated address space.
+ */
+uint32_t gem_vm_create_in_vm_bind_mode(int i915)
+{
+ uint32_t vm_id;
+
+ igt_assert_eq(__gem_vm_create(i915, I915_VM_CREATE_FLAGS_USE_VM_BIND, &vm_id), 0);
igt_assert(vm_id != 0);
return vm_id;