From 036d3dc0660b3b54d6ee2a833a637d096d279834 Mon Sep 17 00:00:00 2001 From: Boyuan Zhang Date: Fri, 23 Jun 2023 01:02:49 -0400 Subject: [PATCH] radeonsi: disable H264HIGH10 profile Issue: H.264 high 10 profile is currently not supported, but is shown as supported in vainfo. Reason: Kernel reported capabilities for video encoder/decode doesn't consider the actual profile (only using reduced profile). Solution: Use kernel reported capabilities only for basic H.264/HEVC profiles. Other profiles (e.g. 10 bits) should be checked based on HW. Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9242 Signed-off-by: Boyuan Zhang Reviewed-by: Ruijing Dong Part-of: --- src/gallium/drivers/radeonsi/si_get.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index e44ebf8..313b303 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -571,6 +571,9 @@ static int si_get_video_param(struct pipe_screen *screen, enum pipe_video_profil { struct si_screen *sscreen = (struct si_screen *)screen; enum pipe_video_format codec = u_reduce_video_profile(profile); + bool fully_supported_profile = ((profile >= PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE) && + (profile <= PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH)) || + (profile == PIPE_VIDEO_PROFILE_HEVC_MAIN); if (entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) { if (!(sscreen->info.ip[AMD_IP_VCE].num_queues || @@ -585,8 +588,8 @@ static int si_get_video_param(struct pipe_screen *screen, enum pipe_video_profil case PIPE_VIDEO_CAP_SUPPORTED: return ( /* in case it is explicitly marked as not supported by the kernel */ - (QUERYABLE_KERNEL ? KERNEL_ENC_CAP(codec, valid) : 1) && - ((codec == PIPE_VIDEO_FORMAT_MPEG4_AVC && + ((QUERYABLE_KERNEL && fully_supported_profile) ? KERNEL_ENC_CAP(codec, valid) : 1) && + ((codec == PIPE_VIDEO_FORMAT_MPEG4_AVC && profile != PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH10 && (sscreen->info.vcn_ip_version >= VCN_1_0_0 || si_vce_is_fw_version_supported(sscreen))) || (profile == PIPE_VIDEO_PROFILE_HEVC_MAIN && (sscreen->info.vcn_ip_version >= VCN_1_0_0 || si_radeon_uvd_enc_supported(sscreen))) || @@ -760,7 +763,7 @@ static int si_get_video_param(struct pipe_screen *screen, enum pipe_video_profil sscreen->info.ip[AMD_IP_VCN_UNIFIED].num_queues : sscreen->info.ip[AMD_IP_VCN_DEC].num_queues))) return false; - if (QUERYABLE_KERNEL && + if (QUERYABLE_KERNEL && fully_supported_profile && sscreen->info.vcn_ip_version >= VCN_1_0_0) return KERNEL_DEC_CAP(codec, valid); if (codec < PIPE_VIDEO_FORMAT_MPEG4_AVC && @@ -778,7 +781,7 @@ static int si_get_video_param(struct pipe_screen *screen, enum pipe_video_profil RVID_ERR("POLARIS10/11 firmware version need to be updated.\n"); return false; } - return true; + return (profile != PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH10); case PIPE_VIDEO_FORMAT_VC1: return !(sscreen->info.vcn_ip_version >= VCN_3_0_33); case PIPE_VIDEO_FORMAT_HEVC: -- 2.7.4