From 13df91d7d7d4a249bd9bbcd102798c630d9eecd3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Jun 2023 12:12:48 +1000 Subject: [PATCH] radv/video: restrict the number of IBs on video related queues. The hardware gets given a session context from userspace in each submission, but if the session context changes the hardware wants a FENCE to be emitted to know it can give up the current session. IF a test submits interleaved session ctx access and uses a single vulkan submit the hardware crashes, unless each IB is submitted in a separate submission so the fence can be sent. In theory it could be possible to construct a single command buffer to trigger this so I do think the hardware should be smarter here. Should this be fixed in the kernel to always emit a fence between IBs? Fixes: dEQP-VK.video.decode.h264_interleaved Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c index 1e83ecf8175..5ef40a8b5d4 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c @@ -45,6 +45,18 @@ do_winsys_init(struct radv_amdgpu_winsys *ws, int fd) if (!ac_query_gpu_info(fd, ws->dev, &ws->info)) return false; + /* + * Override the max submits on video queues. + * If you submit multiple session contexts in the same IB sequence the + * hardware gets upset as it expects a kernel fence to be emitted to reset + * the session context in the hardware. + * Avoid this problem by never submitted more than one IB at a time. + * This possibly should be fixed in the kernel, and if it is this can be + * resolved. + */ + for (enum amd_ip_type ip_type = AMD_IP_UVD; ip_type <= AMD_IP_VCN_ENC; ip_type++) + ws->info.max_submitted_ibs[ip_type] = 1; + if (!ac_query_pci_bus_info(fd, &ws->info)) return false;