diff options
author | Junwei Zhang <Jerry.Zhang@amd.com> | 2018-08-08 17:56:45 +0800 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2018-08-08 12:37:49 +0200 |
commit | f49dccbb24c51de9905582a788bd70e1f3a28efa (patch) | |
tree | ba3665b93d8fdab8ee2a243d427178fb5eb771e5 /amdgpu | |
parent | f693c468c1996445d525bb93ac895772adfb8d0a (diff) | |
download | libdrm-f49dccbb24c51de9905582a788bd70e1f3a28efa.tar.gz libdrm-f49dccbb24c51de9905582a788bd70e1f3a28efa.tar.bz2 libdrm-f49dccbb24c51de9905582a788bd70e1f3a28efa.zip |
amdgpu: add bo from user memory to handle table
When create bo from user memory, add it to handle table
for future query.
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Diffstat (limited to 'amdgpu')
-rw-r--r-- | amdgpu/amdgpu_bo.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c index 422c7c99..b24e6988 100644 --- a/amdgpu/amdgpu_bo.c +++ b/amdgpu/amdgpu_bo.c @@ -556,7 +556,16 @@ int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev, bo->alloc_size = size; bo->handle = args.handle; - *buf_handle = bo; + pthread_mutex_lock(&bo->dev->bo_table_mutex); + r = handle_table_insert(&bo->dev->bo_handles, bo->handle, bo); + pthread_mutex_unlock(&bo->dev->bo_table_mutex); + + pthread_mutex_init(&bo->cpu_access_mutex, NULL); + + if (r) + amdgpu_bo_free(bo); + else + *buf_handle = bo; return r; } |