diff options
author | Leo Liu <leo.liu@amd.com> | 2021-01-19 16:51:02 -0500 |
---|---|---|
committer | Leo Liu <leo.liu@amd.com> | 2021-04-06 08:58:57 -0400 |
commit | 1d13cc1032bf66fca7fc28b7a5d96ceec96285a9 (patch) | |
tree | be7bb62232d6ad7b6a056ace212105116d11fc87 | |
parent | 50c98335c7b40133475193f4522dead20a787844 (diff) |
amdgpu: add function of INFO ioctl for querying video caps
via the newly added uapi/amdgpu_drm interface
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | amdgpu/amdgpu-symbols.txt | 1 | ||||
-rw-r--r-- | amdgpu/amdgpu.h | 17 | ||||
-rw-r--r-- | amdgpu/amdgpu_gpu_info.c | 15 |
3 files changed, 33 insertions, 0 deletions
diff --git a/amdgpu/amdgpu-symbols.txt b/amdgpu/amdgpu-symbols.txt index e3bafaab..a2ed6527 100644 --- a/amdgpu/amdgpu-symbols.txt +++ b/amdgpu/amdgpu-symbols.txt @@ -66,6 +66,7 @@ amdgpu_query_hw_ip_count amdgpu_query_hw_ip_info amdgpu_query_info amdgpu_query_sensor_info +amdgpu_query_video_caps_info amdgpu_read_mm_registers amdgpu_va_range_alloc amdgpu_va_range_free diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index 188179c9..77f58c2b 100644 --- a/amdgpu/amdgpu.h +++ b/amdgpu/amdgpu.h @@ -1238,6 +1238,23 @@ int amdgpu_query_sensor_info(amdgpu_device_handle dev, unsigned sensor_type, unsigned size, void *value); /** + * Query information about video capabilities + * + * The return sizeof(struct drm_amdgpu_info_video_caps) + * + * \param dev - \c [in] Device handle. See #amdgpu_device_initialize() + * \param caps_type - \c [in] AMDGPU_INFO_VIDEO_CAPS_DECODE(ENCODE) + * \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_video_caps_info(amdgpu_device_handle dev, unsigned cap_type, + unsigned size, void *value); + +/** * Read a set of consecutive memory-mapped registers. * Not all registers are allowed to be read by userspace. * diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c index 777087f2..9f8695ce 100644 --- a/amdgpu/amdgpu_gpu_info.c +++ b/amdgpu/amdgpu_gpu_info.c @@ -331,3 +331,18 @@ drm_public int amdgpu_query_sensor_info(amdgpu_device_handle dev, unsigned senso return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request, sizeof(struct drm_amdgpu_info)); } + +drm_public int amdgpu_query_video_caps_info(amdgpu_device_handle dev, unsigned cap_type, + 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_VIDEO_CAPS; + request.sensor_info.type = cap_type; + + return drmCommandWrite(dev->fd, DRM_AMDGPU_INFO, &request, + sizeof(struct drm_amdgpu_info)); +} |