From 93c7f0f9c09d0eb0831fbcb2b4ec7a234b6c4c0b Mon Sep 17 00:00:00 2001 From: Peter Quayle Date: Wed, 14 May 2025 17:00:40 +0200 Subject: [PATCH] pvr: various multiview fixes - Fix ds address offset for multiview. - Fix multiview depth/stencil address by restoring it after every kick. - Enable empty tile processing after first subpass for multiview. Signed-off-by: Peter Quayle Acked-by: Erik Faye-Lund Part-of: --- src/imagination/vulkan/pvr_cmd_buffer.c | 23 +++++++++++++++++------ src/imagination/vulkan/pvr_queue.c | 6 +++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c index 052e1ee1954..06408ceb3f8 100644 --- a/src/imagination/vulkan/pvr_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_cmd_buffer.c @@ -7692,12 +7692,23 @@ void pvr_CmdNextSubpass2(VkCommandBuffer commandBuffer, if (next_hw_render->color_init_count > 0) { rp_info->enable_bg_tag = true; - for (uint32_t i = 0; i < next_hw_render->color_init_count; i++) { - /* Empty tiles need to be cleared too. */ - if (next_hw_render->color_init[i].op == - VK_ATTACHMENT_LOAD_OP_CLEAR) { - rp_info->process_empty_tiles = true; - break; + if (pass->multiview_enabled) { + /* TODO: A more optimized fix would be to selectively enable empty + * tile processing for renders depending on whether the render is + * the first use of a particular view in a renderpass. This would be + * a much larger and more invasive change but could be considered if + * empty tile processing in multiview workloads becomes a + * performance issue. + */ + rp_info->process_empty_tiles = true; + } else { + for (uint32_t i = 0; i < next_hw_render->color_init_count; i++) { + /* Empty tiles need to be cleared too. */ + if (next_hw_render->color_init[i].op == + VK_ATTACHMENT_LOAD_OP_CLEAR) { + rp_info->process_empty_tiles = true; + break; + } } } } diff --git a/src/imagination/vulkan/pvr_queue.c b/src/imagination/vulkan/pvr_queue.c index 4fee75407be..5453edb3c6e 100644 --- a/src/imagination/vulkan/pvr_queue.c +++ b/src/imagination/vulkan/pvr_queue.c @@ -227,7 +227,7 @@ pvr_process_graphics_cmd_for_view(struct pvr_device *device, VkResult result; job->ds.addr = - PVR_DEV_ADDR_OFFSET(job->ds.addr, job->ds.stride * view_index); + PVR_DEV_ADDR_OFFSET(job->ds.addr, job->ds.layer_size * view_index); job->view_state.view_index = view_index; result = vk_sync_create(&device->vk, @@ -336,12 +336,12 @@ static VkResult pvr_process_graphics_cmd(struct pvr_device *device, cmd_buffer, sub_cmd, view_idx); + sub_cmd->job.ds.addr = ds_addr; + if (result != VK_SUCCESS) return result; } - sub_cmd->job.ds.addr = ds_addr; - return VK_SUCCESS; }