Mesa (main): tu: Expose required VK_FORMAT_FEATURE bits for planar YUV formats
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 22 11:52:10 UTC 2021
Module: Mesa
Branch: main
Commit: 2822b1345cff69292a288243a7c2a5e50e487977
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2822b1345cff69292a288243a7c2a5e50e487977
Author: Matt Turner <mattst88 at gmail.com>
Date: Tue Sep 7 17:32:38 2021 -0700
tu: Expose required VK_FORMAT_FEATURE bits for planar YUV formats
Specifically this enables these VK_FORMAT_FEATURE bits:
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
VK_FORMAT_FEATURE_TRANSFER_DST_BIT
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT
VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT
Fixes the following tests:
dEQP-VK.api.info.format_properties.g8_b8_r8_3plane_420_unorm
dEQP-VK.api.info.format_properties.g8_b8r8_2plane_420_unorm
dEQP-VK.api.info.image_format_properties.2d.optimal.g8_b8_r8_3plane_420_unorm
dEQP-VK.api.info.image_format_properties.2d.optimal.g8_b8r8_2plane_420_unorm
Additionally allows 339 tests in dEQP-VK.ycbcr.* to go from Skip to
Pass.
[ Connor: Fake support for 3-plane formats, fixup modifiers path ]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6792>
---
src/freedreno/ci/deqp-freedreno-a630-fails.txt | 9 ---------
src/freedreno/vulkan/tu_formats.c | 13 ++++++++-----
src/freedreno/vulkan/tu_image.c | 17 +++++++++++++++++
src/freedreno/vulkan/tu_private.h | 3 +++
4 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/src/freedreno/ci/deqp-freedreno-a630-fails.txt b/src/freedreno/ci/deqp-freedreno-a630-fails.txt
index f0f60a74b0e..b40a18abb00 100644
--- a/src/freedreno/ci/deqp-freedreno-a630-fails.txt
+++ b/src/freedreno/ci/deqp-freedreno-a630-fails.txt
@@ -53,15 +53,6 @@ bypass-dEQP-GLES31.functional.blend_equation_advanced.msaa.overlay,Fail
bypass-dEQP-GLES31.functional.blend_equation_advanced.msaa.screen,Fail
bypass-dEQP-GLES31.functional.blend_equation_advanced.msaa.softlight,Fail
-# optimalTilingFeatures missing: VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT|VK_FORMAT_FEATURE_TRANSFER_SRC_BIT|VK_FORMAT_FEATURE_TRANSFER_DST_BIT|VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT
-dEQP-VK.api.info.format_properties.g8_b8_r8_3plane_420_unorm,Fail
-dEQP-VK.api.info.format_properties.g8_b8r8_2plane_420_unorm,Fail
-
-dEQP-VK.api.info.image_format_properties.2d.optimal.g8_b8_r8_3plane_420_unorm,Fail
-
-# ERROR: VK_FORMAT_G8_B8R8_2PLANE_420_UNORM must support VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT|VK_FORMAT_FEATURE_TRANSFER_SRC_BIT|VK_FORMAT_FEATURE_TRANSFER_DST_BIT|VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT
-dEQP-VK.api.info.image_format_properties.2d.optimal.g8_b8r8_2plane_420_unorm,Fail
-
# Fails when TU_DEBUG=forcebin is set
dEQP-VK.spirv_assembly.instruction.graphics.variable_pointers.graphics.writes_two_buffers_geom,Fail
dEQP-VK.spirv_assembly.instruction.graphics.variable_pointers.graphics.writes_two_buffers_vert,Fail
diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c
index 0eaf284788d..a84e0616b90 100644
--- a/src/freedreno/vulkan/tu_formats.c
+++ b/src/freedreno/vulkan/tu_formats.c
@@ -252,10 +252,11 @@ tu_physical_device_get_format_properties(
if (tu6_pipe2depth(vk_format) != (enum a6xx_depth_format)~0)
optimal |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
- if (vk_format == VK_FORMAT_G8B8G8R8_422_UNORM ||
- vk_format == VK_FORMAT_B8G8R8G8_422_UNORM ||
- vk_format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM) {
- /* these formats don't support UBWC or tiling */
+ if (!tiling_possible(vk_format) &&
+ /* We don't actually support tiling for this format, but we need to
+ * fake it as it's required by VK_KHR_sampler_ycbcr_conversion.
+ */
+ vk_format != VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM) {
optimal = 0;
}
@@ -311,6 +312,7 @@ tu_GetPhysicalDeviceFormatProperties2(
/* note: ubwc_possible() argument values to be ignored except for format */
if (pFormatProperties->formatProperties.optimalTilingFeatures &&
+ tiling_possible(format) &&
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;
@@ -351,7 +353,8 @@ tu_get_image_format_properties(
/* falling back to linear/non-UBWC isn't possible with explicit modifier */
/* formats which don't support tiling */
- if (!format_props.optimalTilingFeatures)
+ if (!format_props.optimalTilingFeatures ||
+ !tiling_possible(info->format))
return VK_ERROR_FORMAT_NOT_SUPPORTED;
/* for mutable formats, its very unlikely to be possible to use UBWC */
diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 8beb8436cbf..089d07eef91 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -322,6 +322,17 @@ tu_image_view_init(struct tu_image_view *iview,
}
}
+bool
+tiling_possible(VkFormat format)
+{
+ if (format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM ||
+ format == VK_FORMAT_G8B8G8R8_422_UNORM ||
+ format == VK_FORMAT_B8G8R8G8_422_UNORM)
+ return false;
+
+ return true;
+}
+
bool
ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage,
VkImageUsageFlags stencil_usage, const struct fd_dev_info *info,
@@ -456,6 +467,12 @@ tu_CreateImage(VkDevice _device,
ubwc_enabled = false;
}
+ /* Force linear tiling for formats with "fake" optimalTilingFeatures */
+ if (!tiling_possible(image->vk_format)) {
+ tile_mode = TILE6_LINEAR;
+ ubwc_enabled = false;
+ }
+
/* Mutable images can be reinterpreted as any other compatible format.
* This is a problem with UBWC (compression for different formats is different),
* but also tiling ("swap" affects how tiled formats are stored in memory)
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index 850b633f516..613424db7c7 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -1516,6 +1516,9 @@ tu_image_view_init(struct tu_image_view *iview,
const VkImageViewCreateInfo *pCreateInfo,
bool limited_z24s8);
+bool
+tiling_possible(VkFormat format);
+
bool
ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage, VkImageUsageFlags stencil_usage,
const struct fd_dev_info *info, VkSampleCountFlagBits samples);
More information about the mesa-commit
mailing list