tu: Skip tu_tiling_config_update_tile_layout() if not using gmem

Otherwise pass->tile_align_w will be 0, leading to a divide by zero and
undefined behavior. In practice, I saw this lead to an infinite loop in
tests like

dEQP-VK.draw.instanced.draw_indexed_indirect_vk_primitive_topology_line_list_attrib_divisor_0_multiview

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9606>
This commit is contained in:
Matt Turner 2021-03-15 18:54:23 +00:00 committed by Marge Bot
parent 0fbf453689
commit 0b35987895

View file

@ -98,6 +98,12 @@ tu_tiling_config_update_tile_layout(struct tu_framebuffer *fb,
.height = align(fb->height, tile_align_h),
};
/* 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)
return;
if (unlikely(dev->physical_device->instance->debug_flags & TU_DEBUG_FORCEBIN)) {
/* start with 2x2 tiles */
fb->tile_count.width = 2;
@ -120,12 +126,6 @@ tu_tiling_config_update_tile_layout(struct tu_framebuffer *fb,
util_align_npot(DIV_ROUND_UP(fb->height, fb->tile_count.height), tile_align_h);
}
/* 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)
return;
/* do not exceed gmem size */
while (fb->tile0.width * fb->tile0.height > pass->gmem_pixels) {
if (fb->tile0.width > MAX2(tile_align_w, fb->tile0.height)) {