[PATCH libdrm] amdgpu: add amdgpu_bo_handle_type_kms_noimport
Marek Olšák
maraeo at gmail.com
Thu Jul 12 01:29:43 UTC 2018
On Wed, Jul 11, 2018 at 9:14 PM, Zhang, Jerry (Junwei)
<Jerry.Zhang at amd.com> wrote:
> On 07/12/2018 08:47 AM, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>> amdgpu/amdgpu.h | 7 ++++++-
>> amdgpu/amdgpu_bo.c | 4 ++++
>> 2 files changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
>> index 36f91058..be83b457 100644
>> --- a/amdgpu/amdgpu.h
>> +++ b/amdgpu/amdgpu.h
>> @@ -77,21 +77,26 @@ struct drm_amdgpu_info_hw_ip;
>> *
>> */
>> enum amdgpu_bo_handle_type {
>> /** GEM flink name (needs DRM authentication, used by DRI2) */
>> amdgpu_bo_handle_type_gem_flink_name = 0,
>>
>> /** KMS handle which is used by all driver ioctls */
>> 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 */
>> enum amdgpu_gpu_va_range
>> {
>> /** Allocate from "normal"/general range */
>> amdgpu_gpu_va_range_general = 0
>> };
>>
>> enum amdgpu_sw_info {
>> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
>> index 9e37b149..d29be244 100644
>> --- a/amdgpu/amdgpu_bo.c
>> +++ b/amdgpu/amdgpu_bo.c
>> @@ -234,20 +234,22 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
>> case amdgpu_bo_handle_type_gem_flink_name:
>> r = amdgpu_bo_export_flink(bo);
>> if (r)
>> return r;
>>
>> *shared_handle = bo->flink_name;
>> return 0;
>>
>> case amdgpu_bo_handle_type_kms:
>> amdgpu_add_handle_to_table(bo);
>
>
> We may reserve below code for type_kms, which is already used by others.
> *shared_handle = bo->handle;
> return 0;
>
> otherwise, it may break somethings.
What do you mean?
>
> BTW, it's good to introduce a new type for compatibility.
Thanks.
Marek
More information about the amd-gfx
mailing list