From b888946f7a0a037f72159b26f07969460d92ee01 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 18 Jun 2024 14:55:52 +1000 Subject: [PATCH] radv/video: fix layered decode h264/5 tests. CTS tests both layered and separate DPB, but radv wasn't handling layered properly when used with the tier 2 dpb handling. This adjusts the addresses to use the layer index for tier2. Fixes dEQP-VK.video.decode.*layered* Cc: mesa-stable Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_video.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_video.c b/src/amd/vulkan/radv_video.c index c378b8b4a71..a32f5946c86 100644 --- a/src/amd/vulkan/radv_video.c +++ b/src/amd/vulkan/radv_video.c @@ -2460,6 +2460,12 @@ rvcn_dec_message_decode(struct radv_cmd_buffer *cmd_buffer, struct radv_video_se : NULL; struct radv_image *dpb = dpb_update_required ? dpb_iv->image : img; + int dpb_array_idx = 0; + if (dpb_update_required) { + if (dpb_iv->vk.view_type == VK_IMAGE_VIEW_TYPE_2D_ARRAY) + dpb_array_idx = frame_info->pSetupReferenceSlot->pPictureResource->baseArrayLayer; + } + decode->dpb_size = (vid->dpb_type != DPB_DYNAMIC_TIER_2) ? dpb->size : 0; decode->db_pitch = dpb->planes[0].surface.u.gfx9.surf_pitch; decode->db_aligned_height = dpb->planes[0].surface.u.gfx9.surf_height; @@ -2474,6 +2480,8 @@ rvcn_dec_message_decode(struct radv_cmd_buffer *cmd_buffer, struct radv_video_se uint64_t addr; radv_cs_add_buffer(device->ws, cmd_buffer->cs, dpb->bindings[0].bo); addr = radv_buffer_get_va(dpb->bindings[0].bo) + dpb->bindings[0].offset; + + addr += dpb_array_idx * (dpb->planes[0].surface.u.gfx9.surf_slice_size + dpb->planes[1].surface.u.gfx9.surf_slice_size); dynamic_dpb_t2->dpbCurrLo = addr; dynamic_dpb_t2->dpbCurrHi = addr >> 32; @@ -2496,18 +2504,22 @@ rvcn_dec_message_decode(struct radv_cmd_buffer *cmd_buffer, struct radv_video_se radv_image_view_from_handle(frame_info->pReferenceSlots[i].pPictureResource->imageViewBinding); assert(f_dpb_iv != NULL); struct radv_image *dpb_img = f_dpb_iv->image; + int f_dpb_array_idx = 0; + if (f_dpb_iv->vk.view_type == VK_IMAGE_VIEW_TYPE_2D_ARRAY) + f_dpb_array_idx = frame_info->pReferenceSlots[i].pPictureResource->baseArrayLayer; radv_cs_add_buffer(device->ws, cmd_buffer->cs, dpb_img->bindings[0].bo); addr = radv_buffer_get_va(dpb_img->bindings[0].bo) + dpb_img->bindings[0].offset; - + addr += f_dpb_array_idx * (dpb_img->planes[0].surface.u.gfx9.surf_slice_size + dpb_img->planes[1].surface.u.gfx9.surf_slice_size); dynamic_dpb_t2->dpbAddrLo[i] = addr; dynamic_dpb_t2->dpbAddrHi[i] = addr >> 32; + ++dynamic_dpb_t2->dpbArraySize; } radv_cs_add_buffer(device->ws, cmd_buffer->cs, dpb->bindings[0].bo); addr = radv_buffer_get_va(dpb->bindings[0].bo) + dpb->bindings[0].offset; - + addr += dpb_array_idx * (dpb->planes[0].surface.u.gfx9.surf_slice_size + dpb->planes[1].surface.u.gfx9.surf_slice_size); dynamic_dpb_t2->dpbCurrLo = addr; dynamic_dpb_t2->dpbCurrHi = addr >> 32;