@@ -637,6 +637,7 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
* want to map to GPU address space (make GPU accessible)
* (This address must be correctly aligned).
* \param size - [in] Size of allocation (must be correctly aligned)
+ * \param flags - [in] AMDGPU_GEM_USERPTR_* flags for userptr
* \param buf_handle - [out] Buffer handle for the userptr memory
* resource on submission and be used in other operations.
*
@@ -660,6 +661,13 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
* It is responsibility of caller to correctly specify access rights
* on VA assignment.
*/
+int amdgpu_create_bo_from_userptr(amdgpu_device_handle dev,
+ void *cpu, uint64_t size, uint32_t flags,
+ amdgpu_bo_handle *buf_handle);
+
+/**
+ * Deprecated, don't use for new implementations
+ */
int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
void *cpu, uint64_t size,
amdgpu_bo_handle *buf_handle);
@@ -529,18 +529,16 @@ int amdgpu_bo_wait_for_idle(amdgpu_bo_handle bo,
}
}
-int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
- void *cpu,
- uint64_t size,
- amdgpu_bo_handle *buf_handle)
+int amdgpu_create_bo_from_userptr(amdgpu_device_handle dev,
+ void *cpu, uint64_t size, uint32_t flags,
+ amdgpu_bo_handle *buf_handle)
{
- int r;
- struct amdgpu_bo *bo;
struct drm_amdgpu_gem_userptr args;
+ struct amdgpu_bo *bo;
+ int r;
args.addr = (uintptr_t)cpu;
- args.flags = AMDGPU_GEM_USERPTR_ANONONLY | AMDGPU_GEM_USERPTR_REGISTER |
- AMDGPU_GEM_USERPTR_VALIDATE;
+ args.flags = flags;
args.size = size;
r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_GEM_USERPTR,
&args, sizeof(args));
@@ -561,6 +559,18 @@ int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
return r;
}
+int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
+ void *cpu, uint64_t size,
+ amdgpu_bo_handle *buf_handle)
+{
+ uint32_t flags = AMDGPU_GEM_USERPTR_ANONONLY |
+ AMDGPU_GEM_USERPTR_REGISTER |
+ AMDGPU_GEM_USERPTR_VALIDATE;
+
+ return amdgpu_create_bo_from_user_mem(dev, cpu, size,
+ flags, buf_handle);
+}
+
int amdgpu_bo_list_create(amdgpu_device_handle dev,
uint32_t number_of_resources,
amdgpu_bo_handle *resources,