amdgpu: Query uvd handles info
PATCH 1/1 amdgpu: Query uvd handles info
Query the max uvd handles and used uvd handles.
--- amdgpu/amdgpu.h | 14 ++++++++++++++ amdgpu/amdgpu_gpu_info.c | 15 +++++++++++++++ 2 files changed, 29 insertions(+)
amdgpu/amdgpu.h +14 -0
@@ -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. *
amdgpu/amdgpu_gpu_info.c +15 -0
@@ -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) {
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
NAKAm 30.04.19 um 12:51 schrieb Sahu, Satyajit:
Quoted 1 line
Query the max uvd handles and used uvd handles.
NAK, please use the generic amdgpu_query_info() function for this.
Regards,
Christian.
Quoted 48 lines
Signed-off-by Satyajit Sahu <[email protected]>--- amdgpu/amdgpu.h | 14 ++++++++++++++ amdgpu/amdgpu_gpu_info.c | 15 +++++++++++++++ 2 files changed, 29 insertions(+)amdgpu/amdgpu.h +14
-0@@ -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. * amdgpu/amdgpu_gpu_info.c +8
-0@@ -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;
amdgpu/amdgpu_gpu_info.c drm_public int amdgpu_query_info(amdgpu_device_handle dev, unsigned info_id, · line 64
Quoted 10 lines
amdgpu/amdgpu_gpu_info.c +7
-0+ 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Christian König
[CAUTION: External Email]
Am 30.04.19 um 12:51 schrieb Sahu, Satyajit:
Quoted 1 line
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.
Regards,
Satyajit
Quoted 55 lines
Quoted 55 lines
Signed-off-by Satyajit Sahu <[email protected]>---
amdgpu/amdgpu.h | 14 ++++++++++++++
amdgpu/amdgpu_gpu_info.c| 15 +++++++++++++++2 files changed, 29 insertions(+)amdgpu/amdgpu.h +14
-0@@ -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.
*amdgpu/amdgpu_gpu_info.c +11
-0@@ -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; +
Quoted 9 lines
Quoted 8 lines
amdgpu/amdgpu_gpu_info.c +4
-0+ 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 30.04.19 um 13:12 schrieb Sahu, Satyajit:
Quoted 12 lines · Christian König
Quoted 8 lines
[CAUTION: External Email]
Am 30.04.19 um 12:51 schrieb Sahu, Satyajit:
Quoted 1 line
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_infodoes not provide an option to specify thehw_ip_type. ForAMDGPU_INFO_NUM_HANDLESthehw_ip_typeneeds to beAMDGPU_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.
Quoted 62 lines
Regards,
Satyajit
Quoted 57 lines
Quoted 57 lines
Signed-off-by Satyajit Sahu <[email protected]>--- amdgpu/amdgpu.h | 14 ++++++++++++++ amdgpu/amdgpu_gpu_info.c | 15 +++++++++++++++ 2 files changed, 29 insertions(+)amdgpu/amdgpu.h +14
-0@@ -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.
*amdgpu/amdgpu_gpu_info.c +15
-0@@ -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)); +} +
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
amdgpu/amdgpu_gpu_info.c +0
-0drm_public int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id,
int32_t*result) {_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 12 lines · Christian König
[CAUTION: External Email]
Am 30.04.19 um 13:12 schrieb Sahu, Satyajit:
Quoted 9 lines · Christian König
Quoted 8 lines
[CAUTION: External Email]
Am 30.04.19 um 12:51 schrieb Sahu, Satyajit:
Quoted 1 line
Query the max uvd handles and used uvd handles.
NAK, please use the generic
amdgpu_query_info()function for this.Regards,
Christian.
Quoted 8 lines
Quoted 3 lines
Currently
amdgpu_query_infodoes not provide an option to specify thehw_ip_type. ForAMDGPU_INFO_NUM_HANDLESthehw_ip_typeneeds to beAMDGPU_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_typeinstead of hard coding those values.
Should I add a new parameter in amdgpu_query_info or add a new query_info?
Quoted 3 lines
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.
Quoted 8 lines
Regards,
Christian.Quoted 4 lines
Regards,
Satyajit
Regards,
Satyajit
Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
Signed-off-by Satyajit Sahu <[email protected]>---
amdgpu/amdgpu.h | 14 ++++++++++++++
amdgpu/amdgpu_gpu_info.c| 15 +++++++++++++++2 files changed, 29 insertions(+)amdgpu/amdgpu.h +14
-0@@ -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.
*amdgpu/amdgpu_gpu_info.c +15
-0@@ -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)); +} +
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
amdgpu/amdgpu_gpu_info.c +0
-0drm_public int amdgpu_query_crtc_from_id(amdgpu_device_handle dev, unsigned id,
int32_t*result) {_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 30.04.19 um 14:03 schrieb Sahu, Satyajit:
Quoted 13 lines · Christian König
Quoted 12 lines
[CAUTION: External Email]
Am 30.04.19 um 13:12 schrieb Sahu, Satyajit:
Quoted 9 lines · Christian König
Quoted 8 lines
[CAUTION: External Email]
Am 30.04.19 um 12:51 schrieb Sahu, Satyajit:
Quoted 1 line
Query the max uvd handles and used uvd handles.
NAK, please use the generic
amdgpu_query_info()function for this.Regards,
Christian.
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Currently
amdgpu_query_infodoes not provide an option to specify thehw_ip_type. ForAMDGPU_INFO_NUM_HANDLESthehw_ip_typeneeds to beAMDGPU_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_typeinstead of hard coding those values.Should I add a new parameter in
amdgpu_query_infoor add a newquery_info?
Add a new one and please double check if there isn't something existing which can be used.
Quoted 6 lines
Quoted 2 lines
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.
Quoted 75 lines
Quoted 6 lines
Regards,
Christian.Quoted 3 lines
Regards,
Satyajit
Regards,
Satyajit
Quoted 65 lines
Quoted 65 lines
Quoted 53 lines
Quoted 53 lines
Signed-off-by Satyajit Sahu <[email protected]>--- amdgpu/amdgpu.h | 14 ++++++++++++++ amdgpu/amdgpu_gpu_info.c | 15 +++++++++++++++ 2 files changed, 29 insertions(+)amdgpu/amdgpu.h +14
-0@@ -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.
*amdgpu/amdgpu_gpu_info.c +11
-0@@ -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; +Quoted 8 lines
Quoted 8 lines
amdgpu/amdgpu_gpu_info.c +4
-0+ 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel