[PATCH] amdgpu: Query uvd handles info

Sahu, Satyajit Satyajit.Sahu at amd.com
Tue Apr 30 10:51:06 UTC 2019


Query the max uvd handles and used uvd handles.

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)
 {
-- 
2.19.1



More information about the dri-devel mailing list