summaryrefslogtreecommitdiff
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorChad Versace <chad@kiwitree.net>2020-08-08 19:11:33 -0500
committerChad Versace <chad@kiwitree.net>2020-11-17 10:36:45 -0800
commitc9f2a74b5a5da4ccfd69ce83ba1d39e106565714 (patch)
treedf63ebca4faec64069eaf707ade1b1a7f2d1636c /src/intel/vulkan
parentce4f6bda66e32db8cc52233932062bf7bfd256e7 (diff)
anv/image: Respect VkImageFormatListCreateInfo for VkImageFormatProperties (v2)
When filling VkImageFormatProperties, anv_get_image_format_properties() checks the requested VkImageUsageFlags and VkImageCreateFlags against the VkFormatFeatureFlags available to the queried VkFormat. However, we neglected to consider if any formats given in VkImageFormatListCreateInfo further restricted the available VkFormatFeatureFlags. The image view formats are more likely to introduce additional restrictions when DRM format modifiers are present. v2: - Do not drop anv_formats_ccs_e_compatible(). Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v2) Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v2)
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_formats.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index e70263f390a..31d6085fc49 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -908,6 +908,8 @@ anv_get_image_format_properties(
const struct gen_device_info *devinfo = &physical_device->info;
const struct anv_format *format = anv_get_format(info->format);
const struct isl_drm_modifier_info *isl_mod_info = NULL;
+ const VkImageFormatListCreateInfo *format_list_info =
+ vk_find_struct_const(info->pNext, IMAGE_FORMAT_LIST_CREATE_INFO);
if (format == NULL)
goto unsupported;
@@ -925,6 +927,24 @@ anv_get_image_format_properties(
format_feature_flags = anv_get_image_format_features(devinfo, info->format,
format, info->tiling,
isl_mod_info);
+
+ /* Remove the VkFormatFeatureFlags that are incompatible with any declared
+ * image view format. (Removals are more likely to occur when a DRM format
+ * modifier is present).
+ */
+ if ((info->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) && format_list_info) {
+ for (uint32_t i = 0; i < format_list_info->viewFormatCount; ++i) {
+ VkFormat vk_view_format = format_list_info->pViewFormats[i];
+ const struct anv_format *anv_view_format = anv_get_format(vk_view_format);
+ VkFormatFeatureFlags view_format_features =
+ anv_get_image_format_features(devinfo, vk_view_format,
+ anv_view_format,
+ info->tiling,
+ isl_mod_info);
+ format_feature_flags &= view_format_features;
+ }
+ }
+
if (!format_feature_flags)
goto unsupported;
@@ -1071,18 +1091,10 @@ anv_get_image_format_properties(
if (format->n_planes > 1)
goto unsupported;
- if (isl_mod_info->aux_usage == ISL_AUX_USAGE_CCS_E) {
- /* If we have a CCS modifier, ensure that the format supports CCS
- * and, if VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT is set, all of the
- * formats in the format list are CCS compatible.
- */
- const VkImageFormatListCreateInfoKHR *fmt_list =
- vk_find_struct_const(info->pNext,
- IMAGE_FORMAT_LIST_CREATE_INFO_KHR);
- if (!anv_formats_ccs_e_compatible(devinfo, info->flags,
- info->format, info->tiling,
- fmt_list))
- goto unsupported;
+ if (isl_mod_info->aux_usage == ISL_AUX_USAGE_CCS_E &&
+ !anv_formats_ccs_e_compatible(devinfo, info->flags, info->format,
+ info->tiling, format_list_info)) {
+ goto unsupported;
}
}