tu: Initialize tu_tiling_config even when tiling isn't possible

Also avoid calculations required for setting up `tu_tiling_config`
if tiling isn't possible.

Fixes valgrind issue in:
dEQP-VK.draw.renderpass.shader_layer.vertex_shader_256

Signed-off-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32968>
This commit is contained in:
Karmjit Mahil 2025-01-14 11:17:25 +01:00 committed by Marge Bot
parent 8652516ac4
commit 49bdd4bdc0

View file

@ -124,6 +124,15 @@ tu_tiling_config_update_tile_layout(struct tu_framebuffer *fb,
uint32_t tile_align_h = dev->physical_device->info->tile_align_h;
struct tu_tiling_config *tiling = &fb->tiling[gmem_layout];
*tiling = (struct tu_tiling_config) {
/* Put in dummy values that will assertion fail in register setup using
* them, since you shouldn't be doing gmem work if gmem is not possible.
*/
.tile0 = (VkExtent2D) { ~0, ~0 },
.tile_count = (VkExtent2D) { .width = 1, .height = 1 },
.possible = false,
};
/* From the Vulkan 1.3.232 spec, under VkFramebufferCreateInfo:
*
* If the render pass uses multiview, then layers must be one and each
@ -159,17 +168,8 @@ tu_tiling_config_update_tile_layout(struct tu_framebuffer *fb,
/* will force to sysmem, don't bother trying to have a valid tile config
* TODO: just skip all GMEM stuff when sysmem is forced?
*/
if (!pass->gmem_pixels[gmem_layout]) {
tiling->possible = false;
/* Put in dummy values that will assertion fail in register setup using
* them, since you shouldn't be doing gmem work if gmem is not possible.
*/
tiling->tile_count = (VkExtent2D) { 1, 1 };
tiling->tile0 = (VkExtent2D) { ~0, ~0 };
if (!pass->gmem_pixels[gmem_layout])
return;
}
tiling->possible = false;
uint32_t best_tile_count = ~0;
VkExtent2D tile_count;
@ -331,6 +331,9 @@ tu_framebuffer_tiling_config(struct tu_framebuffer *fb,
struct tu_tiling_config *tiling = &fb->tiling[gmem_layout];
tu_tiling_config_update_tile_layout(fb, device, pass,
(enum tu_gmem_layout) gmem_layout);
if (!tiling->possible)
continue;
tu_tiling_config_update_pipe_layout(tiling, device);
tu_tiling_config_update_pipes(tiling, device);
tu_tiling_config_update_binning(tiling, device);