amdgpu: add amdgpu_bo_handle_type_kms_noimport

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
main
Marek Olšák 2018-07-11 20:35:19 -04:00
parent 68bd236aa4
commit 9c979e0ec4
2 changed files with 10 additions and 1 deletions

View 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 */

View 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 */
}