diff options
author | Junwei Zhang <Jerry.Zhang@amd.com> | 2018-08-08 17:56:46 +0800 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2018-08-08 12:37:49 +0200 |
commit | 4d454424e1f25c50e3567dd76c86f9b67d42090a (patch) | |
tree | 532d1a6b3d407f1d662e0e033b38e5e0b862921f /amdgpu/amdgpu.h | |
parent | f49dccbb24c51de9905582a788bd70e1f3a28efa (diff) | |
download | external_libdrm-4d454424e1f25c50e3567dd76c86f9b67d42090a.tar.gz external_libdrm-4d454424e1f25c50e3567dd76c86f9b67d42090a.tar.bz2 external_libdrm-4d454424e1f25c50e3567dd76c86f9b67d42090a.zip |
amdgpu: add a function to find bo by cpu mapping (v2)
Userspace needs to know if the user memory is from BO or malloc.
v2: update mutex range and rebase
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'amdgpu/amdgpu.h')
-rw-r--r-- | amdgpu/amdgpu.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index be83b457..a8c353c6 100644 --- a/amdgpu/amdgpu.h +++ b/amdgpu/amdgpu.h @@ -678,6 +678,29 @@ int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev, amdgpu_bo_handle *buf_handle); /** + * Validate if the user memory comes from BO + * + * \param dev - [in] Device handle. See #amdgpu_device_initialize() + * \param cpu - [in] CPU address of user allocated memory which we + * 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 buf_handle - [out] Buffer handle for the userptr memory + * if the user memory is not from BO, the buf_handle will be NULL. + * \param offset_in_bo - [out] offset in this BO for this user memory + * + * + * \return 0 on success\n + * <0 - Negative POSIX Error code + * +*/ +int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev, + void *cpu, + uint64_t size, + amdgpu_bo_handle *buf_handle, + uint64_t *offset_in_bo); + +/** * Free previosuly allocated memory * * \param dev - \c [in] Device handle. See #amdgpu_device_initialize() |