summaryrefslogtreecommitdiff
path: root/src/freedreno/vulkan
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
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')
-rw-r--r--src/freedreno/vulkan/tu_formats.c4
-rw-r--r--src/freedreno/vulkan/tu_image.c16
-rw-r--r--src/freedreno/vulkan/tu_private.h4
3 files changed, 16 insertions, 8 deletions
diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c
index 62d96cb8af9..abe8929c71d 100644
--- a/src/freedreno/vulkan/tu_formats.c
+++ b/src/freedreno/vulkan/tu_formats.c
@@ -508,7 +508,7 @@ tu_GetPhysicalDeviceFormatProperties2(
/* note: ubwc_possible() argument values to be ignored except for format */
if (pFormatProperties->formatProperties.optimalTilingFeatures &&
- ubwc_possible(format, VK_IMAGE_TYPE_2D, 0, 0, false, VK_SAMPLE_COUNT_1_BIT)) {
+ ubwc_possible(format, VK_IMAGE_TYPE_2D, 0, 0, physical_device->info, VK_SAMPLE_COUNT_1_BIT)) {
vk_outarray_append(&out, mod_props) {
mod_props->drmFormatModifier = DRM_FORMAT_MOD_QCOM_COMPRESSED;
mod_props->drmFormatModifierPlaneCount = 1;
@@ -556,7 +556,7 @@ tu_get_image_format_properties(
return VK_ERROR_FORMAT_NOT_SUPPORTED;
- if (!ubwc_possible(info->format, info->type, info->usage, info->usage, physical_device->info->a6xx.has_z24uint_s8uint, sampleCounts))
+ if (!ubwc_possible(info->format, info->type, info->usage, info->usage, physical_device->info, sampleCounts))
return VK_ERROR_FORMAT_NOT_SUPPORTED;
format_feature_flags = format_props.optimalTilingFeatures;
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 */
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index a2ba4b8f47b..514d28b701a 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -1468,8 +1468,8 @@ tu_image_view_init(struct tu_image_view *iview,
bool limited_z24s8);
bool
-ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, VkImageUsageFlags stencil_usage, bool limited_z24s8,
- VkSampleCountFlagBits samples);
+ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, VkImageUsageFlags stencil_usage,
+ const struct fd_dev_info *info, VkSampleCountFlagBits samples);
struct tu_buffer_view
{