ac: add function for querying video capabilities
It will be used to query caps of decode and encode for hardware AMDGPU supports Signed-off-by: Leo Liu <leo.liu@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10095>
This commit is contained in:
parent
012e84ac11
commit
75a725e4c5
|
@ -155,6 +155,11 @@ int amdgpu_query_gds_info(amdgpu_device_handle dev,
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
int amdgpu_query_video_caps_info(amdgpu_device_handle dev, unsigned cap_type,
|
||||||
|
unsigned size, void *value)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
|
const char *amdgpu_get_marketing_name(amdgpu_device_handle dev)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -474,6 +479,22 @@ bool ac_query_gpu_info(int fd, void *dev_p, struct radeon_info *info,
|
||||||
info->gart_size_kb = DIV_ROUND_UP(info->gart_size, 1024);
|
info->gart_size_kb = DIV_ROUND_UP(info->gart_size, 1024);
|
||||||
info->vram_size_kb = DIV_ROUND_UP(info->vram_size, 1024);
|
info->vram_size_kb = DIV_ROUND_UP(info->vram_size, 1024);
|
||||||
|
|
||||||
|
if (info->drm_minor >= 41) {
|
||||||
|
r = amdgpu_query_video_caps_info(dev, AMDGPU_INFO_VIDEO_CAPS_DECODE,
|
||||||
|
sizeof(info->dec_caps), &(info->dec_caps));
|
||||||
|
if (r) {
|
||||||
|
fprintf(stderr, "amdgpu: amdgpu_query_video_caps_info for decode failed.\n");
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = amdgpu_query_video_caps_info(dev, AMDGPU_INFO_VIDEO_CAPS_ENCODE,
|
||||||
|
sizeof(info->enc_caps), &(info->enc_caps));
|
||||||
|
if (r) {
|
||||||
|
fprintf(stderr, "amdgpu: amdgpu_query_video_caps_info for encode failed.\n");
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Add some margin of error, though this shouldn't be needed in theory. */
|
/* Add some margin of error, though this shouldn't be needed in theory. */
|
||||||
info->all_vram_visible = info->vram_size * 0.9 < info->vram_vis_size;
|
info->all_vram_visible = info->vram_size * 0.9 < info->vram_vis_size;
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,16 @@ struct radeon_info {
|
||||||
uint32_t uvd_fw_version;
|
uint32_t uvd_fw_version;
|
||||||
uint32_t vce_fw_version;
|
uint32_t vce_fw_version;
|
||||||
uint32_t vce_harvest_config;
|
uint32_t vce_harvest_config;
|
||||||
|
struct video_caps_info {
|
||||||
|
struct {
|
||||||
|
uint32_t valid;
|
||||||
|
uint32_t max_width;
|
||||||
|
uint32_t max_height;
|
||||||
|
uint32_t max_pixels_per_frame;
|
||||||
|
uint32_t max_level;
|
||||||
|
uint32_t pad;
|
||||||
|
} codec_info[8]; /* the number of available codecs */
|
||||||
|
} dec_caps, enc_caps;
|
||||||
|
|
||||||
/* Kernel & winsys capabilities. */
|
/* Kernel & winsys capabilities. */
|
||||||
uint32_t drm_major; /* version */
|
uint32_t drm_major; /* version */
|
||||||
|
|
Loading…
Reference in New Issue