All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm 1/6] amdgpu: always add all BOs to lockup table
@ 2018-08-02 14:04 Christian König
       [not found] ` <20180802140452.23894-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Christian König @ 2018-08-02 14:04 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

This way we can always find a BO structure by its handle.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 amdgpu/amdgpu_bo.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index d29be244..39228620 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -88,6 +88,11 @@ int amdgpu_bo_alloc(amdgpu_device_handle dev,
 
 	bo->handle = args.out.handle;
 
+	pthread_mutex_lock(&bo->dev->bo_table_mutex);
+	util_hash_table_set(bo->dev->bo_handles,
+			    (void*)(uintptr_t)bo->handle, bo);
+	pthread_mutex_unlock(&bo->dev->bo_table_mutex);
+
 	pthread_mutex_init(&bo->cpu_access_mutex, NULL);
 
 	*buf_handle = bo;
@@ -168,14 +173,6 @@ int amdgpu_bo_query_info(amdgpu_bo_handle bo,
 	return 0;
 }
 
-static void amdgpu_add_handle_to_table(amdgpu_bo_handle bo)
-{
-	pthread_mutex_lock(&bo->dev->bo_table_mutex);
-	util_hash_table_set(bo->dev->bo_handles,
-			    (void*)(uintptr_t)bo->handle, bo);
-	pthread_mutex_unlock(&bo->dev->bo_table_mutex);
-}
-
 static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
 {
 	struct drm_gem_flink flink;
@@ -240,14 +237,11 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
 		return 0;
 
 	case amdgpu_bo_handle_type_kms:
-		amdgpu_add_handle_to_table(bo);
-		/* fall through */
 	case amdgpu_bo_handle_type_kms_noimport:
 		*shared_handle = bo->handle;
 		return 0;
 
 	case amdgpu_bo_handle_type_dma_buf_fd:
-		amdgpu_add_handle_to_table(bo);
 		return drmPrimeHandleToFD(bo->dev->fd, bo->handle,
 					  DRM_CLOEXEC | DRM_RDWR,
 					  (int*)shared_handle);
-- 
2.14.1

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

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

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

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-02 14:04 [PATCH libdrm 1/6] amdgpu: always add all BOs to lockup table Christian König
     [not found] ` <20180802140452.23894-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-02 14:04   ` [PATCH libdrm 2/6] amdgpu: stop using the hash table for fd_tab Christian König
2018-08-02 14:04   ` [PATCH libdrm 3/6] amdgpu: add handle table implementation Christian König
     [not found]     ` <20180802140452.23894-3-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-02 14:55       ` Michel Dänzer
2018-08-02 15:24       ` William Lewis
2018-08-03  3:03       ` Zhang, Jerry (Junwei)
2018-08-02 14:04   ` [PATCH libdrm 4/6] amdgpu: use handle table for KMS handles Christian König
2018-08-02 14:04   ` [PATCH libdrm 5/6] amdgpu: use handle table for flink names Christian König
2018-08-02 14:04   ` [PATCH libdrm 6/6] amdgpu: remove the hash table implementation Christian König
2018-08-02 14:55   ` [PATCH libdrm 1/6] amdgpu: always add all BOs to lockup table Michel Dänzer
     [not found]     ` <2ede6f59-a1e6-fe9e-396f-2cc961db6df5-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-08-03  3:13       ` Zhang, Jerry (Junwei)

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.