All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm 1/4] amdgpu: add bo from user memory to handle table
@ 2018-08-08  4:08 Junwei Zhang
       [not found] ` <1533701320-23661-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Junwei Zhang @ 2018-08-08  4:08 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Junwei Zhang, christian.koenig-5C7GfCeVMHo

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>
---
 amdgpu/amdgpu_bo.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 422c7c9..b24e698 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;
 }
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-08-08  9:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-08  4:08 [PATCH libdrm 1/4] amdgpu: add bo from user memory to handle table Junwei Zhang
     [not found] ` <1533701320-23661-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-08-08  4:08   ` [PATCH libdrm 2/4] amdgpu: add a function to find bo by cpu mapping (v2) Junwei Zhang
     [not found]     ` <1533701320-23661-2-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-08-08  4:23       ` zhoucm1
     [not found]         ` <b40df073-fc49-0e32-901d-2193f38700ea-5C7GfCeVMHo@public.gmane.org>
2018-08-08  6:48           ` Christian König
     [not found]             ` <2f043d23-5266-4dfc-a703-119a5e9acb5f-5C7GfCeVMHo@public.gmane.org>
2018-08-08  8:11               ` Zhang, Jerry (Junwei)
2018-08-08  8:43               ` zhoucm1
     [not found]                 ` <5ddfa3f1-c71e-0dd8-3ec8-42bc646e3d69-5C7GfCeVMHo@public.gmane.org>
2018-08-08  8:51                   ` Christian König
     [not found]                     ` <7858ed2f-e504-f477-09a7-cd0b5ce90c58-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-08  9:45                       ` Zhang, Jerry (Junwei)
2018-08-08  4:08   ` [PATCH libdrm 3/4] tests/amdgpu: add test for finding bo by CPU mapping Junwei Zhang
2018-08-08  4:08   ` [PATCH libdrm 4/4] amdgpu: add a function to create amdgpu bo internally Junwei Zhang
     [not found]     ` <1533701320-23661-4-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-08-08  6:51       ` Christian König
     [not found]         ` <1371bf42-2f74-f45b-d1f4-113cd44b806a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-08  7:12           ` Zhang, Jerry (Junwei)
     [not found]             ` <5B6A97FB.3000003-5C7GfCeVMHo@public.gmane.org>
2018-08-08  7:18               ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.