summaryrefslogtreecommitdiff
path: root/src/freedreno/vulkan/tu_image.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2021-07-08 10:43:08 -0700
committerMarge Bot <eric+marge@anholt.net>2021-07-14 01:58:00 +0000
commita4559c9550e5efff6e2ebc4c55fb158b4f932910 (patch)
treed953aec9c2c6fcbd7e421d7ac705a1a1f320e274 /src/freedreno/vulkan/tu_image.c
parente552784e68efd771342fad473a48dc6e1eeb8cee (diff)
freedreno+turnip: Add has_8bpp_ubwc
Newer a6xx devices seem to drop 8b/pixel UBWC support. The turnip part was adapted from Jonathans patch on !10892 Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>
Diffstat (limited to 'src/freedreno/vulkan/tu_image.c')
-rw-r--r--src/freedreno/vulkan/tu_image.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 23e831a90cb..804c5dd5b56 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -449,7 +449,7 @@ tu_image_view_init(struct tu_image_view *iview,
bool
ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage,
- VkImageUsageFlags stencil_usage, bool has_z24uint_s8uint,
+ VkImageUsageFlags stencil_usage, const struct fd_dev_info *info,
VkSampleCountFlagBits samples)
{
/* no UBWC with compressed formats, E5B9G9R9, S8_UINT
@@ -460,6 +460,14 @@ ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage,
format == VK_FORMAT_S8_UINT)
return false;
+ if (!info->a6xx.has_8bpp_ubwc &&
+ (format == VK_FORMAT_R8_UNORM ||
+ format == VK_FORMAT_R8_SNORM ||
+ format == VK_FORMAT_R8_UINT ||
+ format == VK_FORMAT_R8_SINT ||
+ format == VK_FORMAT_R8_SRGB))
+ return false;
+
if (type == VK_IMAGE_TYPE_3D) {
tu_finishme("UBWC with 3D textures");
return false;
@@ -488,12 +496,12 @@ ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage,
* Additionally, the special AS_R8G8B8A8 format is broken without UBWC,
* so we have to fallback to 8_8_8_8_UNORM when UBWC is disabled
*/
- if (!has_z24uint_s8uint &&
+ if (!info->a6xx.has_z24uint_s8uint &&
format == VK_FORMAT_D24_UNORM_S8_UINT &&
(stencil_usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT)))
return false;
- if (!has_z24uint_s8uint && samples > VK_SAMPLE_COUNT_1_BIT)
+ if (!info->a6xx.has_z24uint_s8uint && samples > VK_SAMPLE_COUNT_1_BIT)
return false;
return true;
@@ -609,7 +617,7 @@ tu_CreateImage(VkDevice _device,
if (!ubwc_possible(image->vk_format, pCreateInfo->imageType, pCreateInfo->usage,
stencil_usage_info ? stencil_usage_info->stencilUsage : pCreateInfo->usage,
- device->physical_device->info->a6xx.has_z24uint_s8uint, pCreateInfo->samples))
+ device->physical_device->info, pCreateInfo->samples))
ubwc_enabled = false;
/* expect UBWC enabled if we asked for it */