Re: [PATCH] amdgpu: Query uvd handles info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 30.04.19 um 14:03 schrieb Sahu, Satyajit:
> On 4/30/2019 5:02 PM, Christian König wrote:
>> [CAUTION: External Email]
>>
>> Am 30.04.19 um 13:12 schrieb Sahu, Satyajit:
>>> On 4/30/2019 4:29 PM, Christian König wrote:
>>>> [CAUTION: External Email]
>>>>
>>>> Am 30.04.19 um 12:51 schrieb Sahu, Satyajit:
>>>>> Query the max uvd handles and used uvd handles.
>>>> NAK, please use the generic amdgpu_query_info() function for this.
>>>>
>>>> Regards,
>>>> Christian.
>>> Currently amdgpu_query_info does not provide an option to specify the
>>> hw_ip_type. For AMDGPU_INFO_NUM_HANDLES the hw_ip_type needs to be
>>> AMDGPU_HW_IP_UVD, otherwise the kernel returns error.
>> Ok, that makes sense.
>>
>> But please still add a generic query function which takes query and
>> hw_ip_type instead of hard coding those values.
> Should I add a new parameter in amdgpu_query_info or add a new query_info?

Add a new one and please double check if there isn't something existing 
which can be used.

>> BTW: What do you need this for? The number returned is pretty useless on
>> newer hardware.
> On stoney chromebook when  simultaneous used uvd handles exceeds max
> supported uvd handles, there is a failure which is not handled. Thatswhy
> there is a need to check it before allocation so that we can fallback to
> software decoding.

Well that is still racy, e.g. two processes can at the same time query 
that there is only 1 handle slot left and then both try to use it.

Better would be to add the missing handling that we can't create an UVD 
context in this case.

Christian.

>> Regards,
>> Christian.
>>
>>> Regards,
>>>
>>> Satyajit
> Regards,
>
> Satyajit
>
>>>>> Signed-off-by: Satyajit Sahu <satyajit.sahu@xxxxxxx>
>>>>> ---
>>>>>     amdgpu/amdgpu.h          | 14 ++++++++++++++
>>>>>     amdgpu/amdgpu_gpu_info.c | 15 +++++++++++++++
>>>>>     2 files changed, 29 insertions(+)
>>>>>
>>>>> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
>>>>> index c44a495a..407b5fae 100644
>>>>> --- a/amdgpu/amdgpu.h
>>>>> +++ b/amdgpu/amdgpu.h
>>>>> @@ -1174,6 +1174,20 @@ int amdgpu_query_gpu_info(amdgpu_device_handle
>>>>> dev,
>>>>>     int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
>>>>>                       unsigned size, void *value);
>>>>>
>>>>> +/**
>>>>> + * Query uvd handles info.
>>>>> + *
>>>>> + *
>>>>> + * \param   dev     - \c [in] Device handle. See
>>>>> #amdgpu_device_initialize()
>>>>> + * \param   size    - \c [in] Size of the returned value.
>>>>> + * \param   value   - \c [out] Pointer to the return value.
>>>>> + *
>>>>> + * \return   0 on success\n
>>>>> + *          <0 - Negative POSIX error code
>>>>> + *
>>>>> +*/
>>>>> +int amdgpu_query_uvd_handles(amdgpu_device_handle dev,
>>>>> +                      unsigned size, void *value);
>>>>>     /**
>>>>>      * Query hardware or driver information.
>>>>>      *
>>>>> diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c
>>>>> index 777087f2..253c4da7 100644
>>>>> --- a/amdgpu/amdgpu_gpu_info.c
>>>>> +++ b/amdgpu/amdgpu_gpu_info.c
>>>>> @@ -44,6 +44,21 @@ drm_public int
>>>>> amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id,
>>>>>                                sizeof(struct drm_amdgpu_info));
>>>>>     }
>>>>>
>>>>> +drm_public int amdgpu_query_uvd_handles(amdgpu_device_handle dev,
>>>>> +                                        unsigned size, void *value)
>>>>> +{
>>>>> +     struct drm_amdgpu_info request;
>>>>> +
>>>>> +     memset(&request, 0, sizeof(request));
>>>>> +     request.return_pointer = (uintptr_t)value;
>>>>> +     request.return_size = size;
>>>>> +     request.query = AMDGPU_INFO_NUM_HANDLES;
>>>>> +     request.query_hw_ip.type = AMDGPU_HW_IP_UVD;
>>>>> +
>>>>> +     return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request,
>>>>> +                            sizeof(struct drm_amdgpu_info));
>>>>> +}
>>>>> +
>>>>>     drm_public int amdgpu_query_crtc_from_id(amdgpu_device_handle dev,
>>>>> unsigned id,
>>>>>                                          int32_t *result)
>>>>>     {
>>> _______________________________________________
>>> dri-devel mailing list
>>> dri-devel@xxxxxxxxxxxxxxxxxxxxx
>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux