amdgpu: add amdgpu_bo_handle_type_kms_noimport
authorMarek Olšák <marek.olsak@amd.com>
Thu, 12 Jul 2018 00:35:19 +0000 (20:35 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 25 Jul 2018 21:21:44 +0000 (17:21 -0400)
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
amdgpu/amdgpu.h
amdgpu/amdgpu_bo.c

index 36f9105..be83b45 100644 (file)
@@ -84,7 +84,12 @@ enum amdgpu_bo_handle_type {
        amdgpu_bo_handle_type_kms = 1,
 
        /** DMA-buf fd handle */
-       amdgpu_bo_handle_type_dma_buf_fd = 2
+       amdgpu_bo_handle_type_dma_buf_fd = 2,
+
+       /** KMS handle, but re-importing as a DMABUF handle through
+        *  drmPrimeHandleToFD is forbidden. (Glamor does that)
+        */
+       amdgpu_bo_handle_type_kms_noimport = 3,
 };
 
 /** Define known types of GPU VM VA ranges */
index 9e37b14..d29be24 100644 (file)
@@ -241,6 +241,8 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
 
        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;
 
@@ -306,6 +308,7 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
                break;
 
        case amdgpu_bo_handle_type_kms:
+       case amdgpu_bo_handle_type_kms_noimport:
                /* Importing a KMS handle in not allowed. */
                pthread_mutex_unlock(&dev->bo_table_mutex);
                return -EPERM;
@@ -375,6 +378,7 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
                break;
 
        case amdgpu_bo_handle_type_kms:
+       case amdgpu_bo_handle_type_kms_noimport:
                assert(0); /* unreachable */
        }