From 1ae09c4e79fbc5f0a6f2de78b6f3979a83074953 Mon Sep 17 00:00:00 2001 From: Valentine Burley Date: Wed, 28 Aug 2024 16:38:35 +0200 Subject: [PATCH] tu: Use vk_format_get_plane_count for tu6_plane_count This change simplifies the code by avoiding special casing, making it easier to add support for formats like P010 with minimal changes. Inline it on one place where where the difference for VK_FORMAT_D32_SFLOAT_S8_UINT doesn't matter. Signed-off-by: Valentine Burley Part-of: --- src/freedreno/vulkan/tu_image.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/freedreno/vulkan/tu_image.cc b/src/freedreno/vulkan/tu_image.cc index 1de55186206..0278c8f4bf3 100644 --- a/src/freedreno/vulkan/tu_image.cc +++ b/src/freedreno/vulkan/tu_image.cc @@ -34,13 +34,13 @@ uint32_t tu6_plane_count(VkFormat format) { switch (format) { - default: - return 1; - case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: case VK_FORMAT_D32_SFLOAT_S8_UINT: + /* We do not support interleaved depth/stencil. Instead, we decompose to + * a depth plane and a stencil plane. + */ return 2; - case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM: - return 3; + default: + return vk_format_get_plane_count(format); } } @@ -349,7 +349,7 @@ ubwc_possible(struct tu_device *device, if (!info->a6xx.has_8bpp_ubwc && vk_format_get_blocksizebits(format) == 8 && - tu6_plane_count(format) == 1) + vk_format_get_plane_count(format) == 1) return false; if (type == VK_IMAGE_TYPE_3D) {