broadcom: Fix slice memory allocation logic for compressed textures

Compressed textures require their width and height padding to be
calculated based on the number of blocks in the image. This change ensures
that the number of blocks in the texture is a POT for mip levels > 1.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23133>
This commit is contained in:
Lucas Fryzek 2023-05-19 11:40:51 -04:00 committed by Marge Bot
parent fe973222a9
commit 3e44b14af8

View file

@ -135,6 +135,16 @@ v3d_setup_plane_slices(struct v3dv_image *image, uint8_t plane,
level_width = DIV_ROUND_UP(level_width, block_width);
level_height = DIV_ROUND_UP(level_height, block_height);
/* Converting to the block size may have made it so the level_width
* and level height are no longer a POT for mip levels > 1, therefore
* if this is a mip level greater than 1 we set level_width and
* level_height to the next power of two
*/
if (i > 1) {
level_width = util_next_power_of_two(level_width);
level_height = util_next_power_of_two(level_height);
}
if (!image->tiled) {
slice->tiling = V3D_TILING_RASTER;
if (image->vk.image_type == VK_IMAGE_TYPE_1D)