tu: Use vk_format_get_plane_width/height to get the plane dimensions

This change simplifies the code by avoiding special casing, making it easier to add support
for formats like P010 with minimal changes.

Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30899>
This commit is contained in:
Valentine Burley
2024-08-28 16:36:19 +02:00
committed by Marge Bot
parent b37e06fd58
commit 29d1cd6e8b

View File

@@ -499,25 +499,12 @@ tu_image_update_layout(struct tu_device *device, struct tu_image *image,
for (uint32_t i = 0; i < tu6_plane_count(image->vk.format); i++) {
struct fdl_layout *layout = &image->layout[i];
enum pipe_format format = tu6_plane_format(image->vk.format, i);
uint32_t width0 = image->vk.extent.width;
uint32_t height0 = image->vk.extent.height;
uint32_t width0 = vk_format_get_plane_width(image->vk.format, i, image->vk.extent.width);
uint32_t height0 = vk_format_get_plane_height(image->vk.format, i, image->vk.extent.height);
if (i > 0) {
switch (image->vk.format) {
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
/* half width/height on chroma planes */
width0 = (width0 + 1) >> 1;
height0 = (height0 + 1) >> 1;
break;
case VK_FORMAT_D32_SFLOAT_S8_UINT:
/* no UBWC for separate stencil */
image->ubwc_enabled = false;
break;
default:
break;
}
}
if (i == 1 && image->vk.format == VK_FORMAT_D32_SFLOAT_S8_UINT)
/* no UBWC for separate stencil */
image->ubwc_enabled = false;
struct fdl_explicit_layout plane_layout;