[PATCH] amdgpu: Query uvd handles info

Christian König ckoenig.leichtzumerken at gmail.com
Tue Apr 30 11:32:51 UTC 2019


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.

BTW: What do you need this for? The number returned is pretty useless on 
newer hardware.

Regards,
Christian.

>
> Regards,
>
> Satyajit
>
>>> Signed-off-by: Satyajit Sahu <satyajit.sahu at amd.com>
>>> ---
>>>    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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



More information about the dri-devel mailing list