radv/video: fix h265 decode with unaligned w/h

This is similiar to the h264 fix done previously.

Fixes decoding with the nvpro samples app and a test video.

Fixes: db62c38091 ("radv: add vcn h265 decode.")
Reviewed-by: Lynne <dev@lynne.ee>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28359>
(cherry picked from commit 4fc2ab43c0)
This commit is contained in:
Dave Airlie 2024-03-25 14:23:08 +10:00 committed by Eric Engestrom
parent 0bc813906c
commit 25dac7bc12
2 changed files with 17 additions and 5 deletions

View file

@ -2084,7 +2084,7 @@
"description": "radv/video: fix h265 decode with unaligned w/h",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "db62c38091a3b244b1d720a6aa47bf1d1855db55",
"notes": null

View file

@ -934,7 +934,10 @@ update_h265_scaling(void *it_ptr, const StdVideoH265ScalingLists *scaling_lists)
static rvcn_dec_message_hevc_t
get_h265_msg(struct radv_device *device, struct radv_video_session *vid, struct radv_video_session_params *params,
const struct VkVideoDecodeInfoKHR *frame_info, void *it_ptr)
const struct VkVideoDecodeInfoKHR *frame_info,
uint32_t *width_in_samples,
uint32_t *height_in_samples,
void *it_ptr)
{
rvcn_dec_message_hevc_t result;
int i, j;
@ -966,6 +969,8 @@ get_h265_msg(struct radv_device *device, struct radv_video_session *vid, struct
}
result.st_rps_bits = h265_pic_info->pStdPictureInfo->NumBitsForSTRefPicSetInSlice;
*width_in_samples = sps->pic_width_in_luma_samples;
*height_in_samples = sps->pic_height_in_luma_samples;
result.chroma_format = sps->chroma_format_idc;
result.bit_depth_luma_minus8 = sps->bit_depth_luma_minus8;
result.bit_depth_chroma_minus8 = sps->bit_depth_chroma_minus8;
@ -1220,7 +1225,8 @@ rvcn_dec_message_decode(struct radv_cmd_buffer *cmd_buffer, struct radv_video_se
break;
}
case VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR: {
rvcn_dec_message_hevc_t hevc = get_h265_msg(device, vid, params, frame_info, it_ptr);
rvcn_dec_message_hevc_t hevc =
get_h265_msg(device, vid, params, frame_info, &decode->width_in_samples, &decode->height_in_samples, it_ptr);
memcpy(codec, (void *)&hevc, sizeof(rvcn_dec_message_hevc_t));
index_codec->message_id = RDECODE_MESSAGE_HEVC;
break;
@ -1377,7 +1383,8 @@ get_uvd_h264_msg(struct radv_video_session *vid, struct radv_video_session_param
static struct ruvd_h265
get_uvd_h265_msg(struct radv_device *device, struct radv_video_session *vid, struct radv_video_session_params *params,
const struct VkVideoDecodeInfoKHR *frame_info, void *it_ptr)
const struct VkVideoDecodeInfoKHR *frame_info, uint32_t *width_in_samples,
uint32_t *height_in_samples, void *it_ptr)
{
struct ruvd_h265 result;
int i, j;
@ -1405,6 +1412,8 @@ get_uvd_h265_msg(struct radv_device *device, struct radv_video_session *vid, str
if (device->physical_device->rad_info.family == CHIP_CARRIZO)
result.sps_info_flags |= 1 << 9;
*width_in_samples = sps->pic_width_in_luma_samples;
*height_in_samples = sps->pic_height_in_luma_samples;
result.chroma_format = sps->chroma_format_idc;
result.bit_depth_luma_minus8 = sps->bit_depth_luma_minus8;
result.bit_depth_chroma_minus8 = sps->bit_depth_chroma_minus8;
@ -1578,7 +1587,10 @@ ruvd_dec_message_decode(struct radv_device *device, struct radv_video_session *v
break;
}
case VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR: {
msg->body.decode.codec.h265 = get_uvd_h265_msg(device, vid, params, frame_info, it_ptr);
msg->body.decode.codec.h265 = get_uvd_h265_msg(device, vid, params, frame_info,
&msg->body.decode.width_in_samples,
&msg->body.decode.height_in_samples,
it_ptr);
if (vid->ctx.mem)
msg->body.decode.dpb_reserved = vid->ctx.size;