radv/video: Avoid selecting rc layer over maximum

Vulkan spec doesn't say if this is allowed or not, but trying
to do this will hang.

Fixes: 4a19047d32 ("radv/video: Select temporal layer when encoding each frame")
Reviewed-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit d1c1a33b35)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32261>
This commit is contained in:
David Rosca 2024-10-22 13:45:24 +02:00 committed by Dylan Baker
parent bab3391381
commit c1517edde6
2 changed files with 4 additions and 3 deletions

View file

@ -154,7 +154,7 @@
"description": "radv/video: Avoid selecting rc layer over maximum",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "4a19047d329a49ed34fe05346ae1d298d2907e3e",
"notes": null

View file

@ -1362,6 +1362,7 @@ radv_enc_params(struct radv_cmd_buffer *cmd_buffer, const VkVideoEncodeInfoKHR *
uint64_t chroma_va = va + src_img->planes[1].surface.u.gfx9.surf_offset;
uint32_t pic_type;
unsigned int slot_idx = 0xffffffff;
unsigned int max_layers = cmd_buffer->video.vid->rc_layer_control.max_num_temporal_layers;
radv_cs_add_buffer(device->ws, cs, src_img->bindings[0].bo);
if (h264_pic) {
@ -1380,7 +1381,7 @@ radv_enc_params(struct radv_cmd_buffer *cmd_buffer, const VkVideoEncodeInfoKHR *
pic_type = RENCODE_PICTURE_TYPE_I;
break;
}
radv_enc_layer_select(cmd_buffer, h264_pic->temporal_id);
radv_enc_layer_select(cmd_buffer, MIN2(h264_pic->temporal_id, max_layers));
} else if (h265_pic) {
switch (h265_pic->pic_type) {
case STD_VIDEO_H265_PICTURE_TYPE_P:
@ -1397,7 +1398,7 @@ radv_enc_params(struct radv_cmd_buffer *cmd_buffer, const VkVideoEncodeInfoKHR *
pic_type = RENCODE_PICTURE_TYPE_I;
break;
}
radv_enc_layer_select(cmd_buffer, h265_pic->TemporalId);
radv_enc_layer_select(cmd_buffer, MIN2(h265_pic->TemporalId, max_layers));
} else {
assert(0);
return;