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-07  7:26 Junwei Zhang
       [not found] ` <1533626820-7701-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: Junwei Zhang @ 2018-08-07  7:26 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>
---
 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] 19+ messages in thread
* [PATCH libdrm 1/4] amdgpu: add bo from user memory to handle table
@ 2018-08-08  4:08 Junwei Zhang
  0 siblings, 0 replies; 19+ 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] 19+ messages in thread

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

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-07  7:26 [PATCH libdrm 1/4] amdgpu: add bo from user memory to handle table Junwei Zhang
     [not found] ` <1533626820-7701-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-08-07  7:26   ` [PATCH libdrm 2/4] amdgpu: add count for " Junwei Zhang
2018-08-07  7:26   ` [PATCH libdrm 3/4] amdgpu: add a function to find bo by cpu mapping Junwei Zhang
     [not found]     ` <1533626820-7701-3-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-08-07  7:55       ` zhoucm1
     [not found]         ` <543dd2f7-861a-c56e-f743-3c1c87602034-5C7GfCeVMHo@public.gmane.org>
2018-08-07  9:30           ` Christian König
     [not found]             ` <8fb413b3-811a-f984-a9b2-3dcd89b55bd7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-07 10:18               ` zhoucm1
2018-08-07  8:20       ` Christian König
     [not found]         ` <b0ec5154-45a3-4b58-cc7f-1fa5916e552a-5C7GfCeVMHo@public.gmane.org>
2018-08-07  8:28           ` Zhang, Jerry (Junwei)
     [not found]             ` <5B695839.4050604-5C7GfCeVMHo@public.gmane.org>
2018-08-07  9:33               ` Christian König
     [not found]                 ` <83000f07-20bf-dd0f-4898-3558e626c9d1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-07  9:52                   ` Zhang, Jerry (Junwei)
     [not found]                     ` <5B696BD1.6060707-5C7GfCeVMHo@public.gmane.org>
2018-08-07  9:59                       ` Christian König
     [not found]                         ` <f41dc914-3ae3-2bda-a987-476154f3fea1-5C7GfCeVMHo@public.gmane.org>
2018-08-07 10:23                           ` Zhang, Jerry (Junwei)
     [not found]                             ` <5B69733C.4050707-5C7GfCeVMHo@public.gmane.org>
2018-08-07 11:30                               ` Christian König
2018-08-07 11:35       ` Christian König
2018-08-07  7:27   ` [PATCH libdrm 4/4] tests/amdgpu: add test for finding bo by CPU mapping Junwei Zhang
2018-08-07  7:51   ` [PATCH libdrm 1/4] amdgpu: add bo from user memory to handle table zhoucm1
     [not found]     ` <a3b83620-72e5-76ea-5005-04f71c46f7c3-5C7GfCeVMHo@public.gmane.org>
2018-08-07  9:54       ` Zhang, Jerry (Junwei)
     [not found]         ` <5B696C56.9030403-5C7GfCeVMHo@public.gmane.org>
2018-08-07 10:01           ` Christian König
  -- strict thread matches above, loose matches on Subject: below --
2018-08-08  4:08 Junwei Zhang

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.