winsys/radeon: unify radeon_bo::flink and radeon_bo::name
authorMarek Olšák <marek.olsak@amd.com>
Fri, 4 Apr 2014 18:22:55 +0000 (20:22 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 10 Apr 2014 18:50:17 +0000 (20:50 +0200)
Both contained the GEM flink name.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/winsys/radeon/drm/radeon_drm_bo.c
src/gallium/winsys/radeon/drm/radeon_drm_bo.h

index e593af231a981ad552218fff709678d3928887a4..34f26bb4e0c8a7199663a88710b50c221247e3bd 100644 (file)
@@ -317,9 +317,9 @@ static void radeon_bo_destroy(struct pb_buffer *_buf)
 
     pipe_mutex_lock(bo->mgr->bo_handles_mutex);
     util_hash_table_remove(bo->mgr->bo_handles, (void*)(uintptr_t)bo->handle);
-    if (bo->name) {
+    if (bo->flink_name) {
         util_hash_table_remove(bo->mgr->bo_names,
-                               (void*)(uintptr_t)bo->name);
+                               (void*)(uintptr_t)bo->flink_name);
     }
     pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
 
@@ -893,7 +893,7 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
         }
         handle = open_arg.handle;
         size = open_arg.size;
-        bo->name = whandle->handle;
+        bo->flink_name = whandle->handle;
     } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) {
         size = lseek(whandle->handle, 0, SEEK_END);
         /* 
@@ -920,8 +920,8 @@ static struct pb_buffer *radeon_winsys_bo_from_handle(struct radeon_winsys *rws,
     bo->va = 0;
     pipe_mutex_init(bo->map_mutex);
 
-    if (bo->name)
-        util_hash_table_set(mgr->bo_names, (void*)(uintptr_t)bo->name, bo);
+    if (bo->flink_name)
+        util_hash_table_set(mgr->bo_names, (void*)(uintptr_t)bo->flink_name, bo);
 
     util_hash_table_set(mgr->bo_handles, (void*)(uintptr_t)bo->handle, bo);
 
@@ -989,21 +989,20 @@ static boolean radeon_winsys_bo_get_handle(struct pb_buffer *buffer,
     memset(&flink, 0, sizeof(flink));
 
     if (whandle->type == DRM_API_HANDLE_TYPE_SHARED) {
-        if (!bo->flinked) {
+        if (!bo->flink_name) {
             flink.handle = bo->handle;
 
             if (ioctl(bo->rws->fd, DRM_IOCTL_GEM_FLINK, &flink)) {
                 return FALSE;
             }
 
-            bo->flinked = TRUE;
-            bo->flink = flink.name;
+            bo->flink_name = flink.name;
 
             pipe_mutex_lock(bo->mgr->bo_handles_mutex);
-            util_hash_table_set(bo->mgr->bo_names, (void*)(uintptr_t)bo->flink, bo);
+            util_hash_table_set(bo->mgr->bo_names, (void*)(uintptr_t)bo->flink_name, bo);
             pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
         }
-        whandle->handle = bo->flink;
+        whandle->handle = bo->flink_name;
     } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
         whandle->handle = bo->handle;
     } else if (whandle->type == DRM_API_HANDLE_TYPE_FD) {
index 5536bc1022f2c35107b2a8bf317490e1f6b6f11b..f5b122f17c72e49ed569c583fe6e4c4a4e909990 100644 (file)
@@ -54,7 +54,7 @@ struct radeon_bo {
     pipe_mutex map_mutex;
 
     uint32_t handle;
-    uint32_t name;
+    uint32_t flink_name;
     uint64_t va;
     enum radeon_bo_domain initial_domain;
 
@@ -64,9 +64,6 @@ struct radeon_bo {
     /* how many command streams, which are being emitted in a separate
      * thread, is this bo referenced in? */
     int num_active_ioctls;
-
-    boolean flinked;
-    uint32_t flink;
 };
 
 struct pb_manager *radeon_bomgr_create(struct radeon_drm_winsys *rws);