diff options
author | Rob Clark <robdclark@chromium.org> | 2021-07-08 10:43:08 -0700 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-07-14 01:58:00 +0000 |
commit | a4559c9550e5efff6e2ebc4c55fb158b4f932910 (patch) | |
tree | d953aec9c2c6fcbd7e421d7ac705a1a1f320e274 | |
parent | e552784e68efd771342fad473a48dc6e1eeb8cee (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>
-rw-r--r-- | src/freedreno/common/freedreno_dev_info.h | 2 | ||||
-rw-r--r-- | src/freedreno/common/freedreno_devices.py | 1 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_formats.c | 4 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_image.c | 16 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_private.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_resource.c | 7 |
6 files changed, 24 insertions, 10 deletions
diff --git a/src/freedreno/common/freedreno_dev_info.h b/src/freedreno/common/freedreno_dev_info.h index eaa64015e58..d87fb0d8b55 100644 --- a/src/freedreno/common/freedreno_dev_info.h +++ b/src/freedreno/common/freedreno_dev_info.h @@ -94,6 +94,8 @@ struct fd_dev_info { */ bool has_cp_reg_write; + bool has_8bpp_ubwc; + struct { uint32_t RB_UNKNOWN_8E04_blit; uint32_t PC_UNKNOWN_9805; diff --git a/src/freedreno/common/freedreno_devices.py b/src/freedreno/common/freedreno_devices.py index eb29fea6fd3..08cfc7b6262 100644 --- a/src/freedreno/common/freedreno_devices.py +++ b/src/freedreno/common/freedreno_devices.py @@ -115,6 +115,7 @@ class A6xxGPUInfo(GPUInfo): # Things that earlier gens have and later gens remove, provide # defaults here and let them be overridden by sub-gen template: self.a6xx.has_cp_reg_write = True + self.a6xx.has_8bpp_ubwc = True for name, val in template.items(): setattr(self.a6xx, name, val) 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 { diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c index 5adb2a8b92d..1869776358c 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c @@ -39,6 +39,8 @@ static bool ok_ubwc_format(struct pipe_screen *pscreen, enum pipe_format pfmt) { + const struct fd_dev_info *info = fd_screen(pscreen)->info; + switch (pfmt) { case PIPE_FORMAT_X24S8_UINT: case PIPE_FORMAT_Z24_UNORM_S8_UINT: @@ -47,7 +49,7 @@ ok_ubwc_format(struct pipe_screen *pscreen, enum pipe_format pfmt) * fd_resource_uncompress() at the point of stencil sampling because * that itself uses stencil sampling in the fd_blitter_blit path. */ - return fd_screen(pscreen)->info->a6xx.has_z24uint_s8uint; + return info->a6xx.has_z24uint_s8uint; case PIPE_FORMAT_R8_G8B8_420_UNORM: return true; @@ -81,10 +83,11 @@ ok_ubwc_format(struct pipe_screen *pscreen, enum pipe_format pfmt) case FMT6_8_8_SINT: case FMT6_8_8_UINT: case FMT6_8_8_UNORM: - case FMT6_8_UNORM: case FMT6_Z24_UNORM_S8_UINT: case FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8: return true; + case FMT6_8_UNORM: + return info->a6xx.has_8bpp_ubwc; default: return false; } |