amdgpu: add amdgpu_create_bo_from_userptr()
PATCH 1/1 amdgpu: add amdgpu_create_bo_from_userptr()
From: Christian König <[email protected]>
We somehow forgot the flags paramter in amdgpu_create_bo_from_user_mem(). Fix that with a new function.
Signed-off-by Christian König <[email protected]>
--- amdgpu/amdgpu.h | 8 ++++++++ amdgpu/amdgpu_bo.c | 26 ++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-)
amdgpu/amdgpu.h +8 -0
@@ -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);
amdgpu/amdgpu_bo.c +18 -8
@@ -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,
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Christian König
From: Christian König <[email protected]>
We somehow forgot the flags paramter in
amdgpu_create_bo_from_user_mem(). Fix that with a new function.Signed-off-by Christian König <[email protected]>
Reviewed-by Michel Dänzer <[email protected]>
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel