Module: Mesa Branch: main Commit: 046cc51223f009dbaf47535c54afd70a77c0a28a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=046cc51223f009dbaf47535c54afd70a77c0a28a
Author: Boyuan Zhang <[email protected]> Date: Wed Nov 29 19:44:54 2023 -0500 radeonsi/vcn: add new logic for hevc multi slices reflist For multi slices hevc decoding, use the newly defined buffer to handle the case for multi slices ref pic list. Signed-off-by: Boyuan Zhang <[email protected]> Reviewed-by: Leo Liu <[email protected]> Reviewed-by: Ruijing Dong <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26081> --- src/gallium/drivers/radeonsi/radeon_vcn_dec.c | 44 +++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c index 4755af42de4..b873958609e 100644 --- a/src/gallium/drivers/radeonsi/radeon_vcn_dec.c +++ b/src/gallium/drivers/radeonsi/radeon_vcn_dec.c @@ -21,7 +21,7 @@ #include "ac_vcn_av1_default.h" -#define FB_BUFFER_OFFSET 0x1000 +#define FB_BUFFER_OFFSET 0x2000 #define FB_BUFFER_SIZE 2048 #define IT_SCALING_TABLE_SIZE 992 #define VP9_PROBS_TABLE_SIZE (RDECODE_VP9_PROBS_DATA_SIZE + 256) @@ -312,7 +312,9 @@ static rvcn_dec_message_hevc_t get_h265_msg(struct radeon_decoder *dec, if (pic->UseStRpsBits == true && pic->pps->st_rps_bits != 0) { result.sps_info_flags |= 1 << 11; result.st_rps_bits = pic->pps->st_rps_bits; - } + } + + result.sps_info_flags |= 1 << 12; result.chroma_format = pic->pps->sps->chroma_format_idc; result.bit_depth_luma_minus8 = pic->pps->sps->bit_depth_luma_minus8; @@ -677,6 +679,18 @@ static rvcn_dec_message_vp9_t get_vp9_msg(struct radeon_decoder *dec, return result; } +static void get_h265_reflist(rvcn_dec_message_hevc_direct_ref_list_t *hevc_reflist, + struct pipe_h265_picture_desc *pic) +{ + hevc_reflist->num_direct_reflist = pic->slice_parameter.slice_count; + for (int i = 0; i <hevc_reflist->num_direct_reflist; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 15; k++) + hevc_reflist->multi_direct_reflist[i][j][k] = pic->RefPicList[i][j][k]; + } + } +} + static void set_drm_keys(rvcn_dec_message_drm_t *drm, DECRYPT_PARAMETERS *decrypted) { int cbc = decrypted->u.s.cbc; @@ -1912,13 +1926,15 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec, rvcn_dec_message_index_t *index_codec; rvcn_dec_message_index_t *index_drm = NULL; rvcn_dec_message_index_t *index_dynamic_dpb = NULL; + rvcn_dec_message_index_t *index_hevc_direct_reflist = NULL; rvcn_dec_message_decode_t *decode; unsigned sizes = 0, offset_decode, offset_codec; - unsigned offset_drm = 0, offset_dynamic_dpb = 0; + unsigned offset_drm = 0, offset_dynamic_dpb = 0, offset_hevc_direct_reflist = 0; void *codec; rvcn_dec_message_drm_t *drm = NULL; rvcn_dec_message_dynamic_dpb_t *dynamic_dpb = NULL; rvcn_dec_message_dynamic_dpb_t2_t *dynamic_dpb_t2 = NULL; + rvcn_dec_message_hevc_direct_ref_list_t *hevc_reflist = NULL; bool dpb_resize = false; header = dec->msg; sizes += sizeof(rvcn_dec_message_header_t); @@ -1936,6 +1952,11 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec, sizes += sizeof(rvcn_dec_message_index_t); } + if (u_reduce_video_profile(picture->profile) == PIPE_VIDEO_FORMAT_HEVC) { + index_hevc_direct_reflist = (void*)header + sizes; + sizes += sizeof(rvcn_dec_message_index_t); + } + offset_decode = sizes; decode = (void*)header + sizes; sizes += sizeof(rvcn_dec_message_decode_t); @@ -1958,6 +1979,12 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec, } } + if (u_reduce_video_profile(picture->profile) == PIPE_VIDEO_FORMAT_HEVC) { + offset_hevc_direct_reflist = sizes; + hevc_reflist = (void*)header + sizes; + sizes += align((4 + 2 * 15 * ((struct pipe_h265_picture_desc *)picture)->slice_parameter.slice_count), 4); + } + offset_codec = sizes; codec = (void*)header + sizes; @@ -1998,6 +2025,14 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec, index_dynamic_dpb->size = sizeof(rvcn_dec_message_dynamic_dpb_t2_t); } + if (u_reduce_video_profile(picture->profile) == PIPE_VIDEO_FORMAT_HEVC) { + index_hevc_direct_reflist->message_id = RDECODE_MESSAGE_HEVC_DIRECT_REF_LIST; + index_hevc_direct_reflist->offset = offset_hevc_direct_reflist; + index_hevc_direct_reflist->size = align((4 + 2 * 15 * ((struct pipe_h265_picture_desc *)picture)->slice_parameter.slice_count), 4); + index_hevc_direct_reflist->filled = 0; + ++header->num_buffers; + } + decode->stream_type = dec->stream_type; decode->decode_flags = 0; decode->width_in_samples = dec->base.width; @@ -2209,6 +2244,9 @@ static struct pb_buffer *rvcn_dec_message_decode(struct radeon_decoder *dec, } } + if (u_reduce_video_profile(picture->profile) == PIPE_VIDEO_FORMAT_HEVC) + get_h265_reflist(hevc_reflist, (struct pipe_h265_picture_desc *)picture); + switch (u_reduce_video_profile(picture->profile)) { case PIPE_VIDEO_FORMAT_MPEG4_AVC: { rvcn_dec_message_avc_t avc = get_h264_msg(dec, target, (struct pipe_h264_picture_desc *)picture);
