Module: Mesa Branch: main Commit: 727335045dd7bba6d835cb0a3b9cad2dfc3171f9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=727335045dd7bba6d835cb0a3b9cad2dfc3171f9
Author: Matt Turner <[email protected]> Date: Wed Jun 21 12:54:42 2023 -0400 anv: Pipe anv_physical_device to anv_get_image_format_features2 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23776> --- src/intel/vulkan/anv_android.c | 2 +- src/intel/vulkan/anv_formats.c | 36 ++++++++++++++++++++---------------- src/intel/vulkan/anv_private.h | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c index 0010c2ffd6f..dedca480e48 100644 --- a/src/intel/vulkan/anv_android.c +++ b/src/intel/vulkan/anv_android.c @@ -185,7 +185,7 @@ get_ahw_buffer_format_properties2( tiling = VK_IMAGE_TILING_LINEAR; p->formatFeatures = - anv_get_image_format_features2(device->info, p->format, anv_format, + anv_get_image_format_features2(device->physical, p->format, anv_format, tiling, NULL); /* "Images can be created with an external format even if the Android hardware diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 6dbe7224bce..437d145d74a 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -516,12 +516,13 @@ anv_get_format_aspect(const struct intel_device_info *devinfo, // Format capabilities VkFormatFeatureFlags2 -anv_get_image_format_features2(const struct intel_device_info *devinfo, +anv_get_image_format_features2(const struct anv_physical_device *physical_device, VkFormat vk_format, const struct anv_format *anv_format, VkImageTiling vk_tiling, const struct isl_drm_modifier_info *isl_mod_info) { + const struct intel_device_info *devinfo = &physical_device->info; VkFormatFeatureFlags2 flags = 0; if (anv_format == NULL) @@ -873,7 +874,6 @@ get_drm_format_modifier_properties_list(const struct anv_physical_device *physic VkFormat vk_format, VkDrmFormatModifierPropertiesListEXT *list) { - const struct intel_device_info *devinfo = &physical_device->info; const struct anv_format *anv_format = anv_get_format(vk_format); VK_OUTARRAY_MAKE_TYPED(VkDrmFormatModifierPropertiesEXT, out, @@ -882,7 +882,7 @@ get_drm_format_modifier_properties_list(const struct anv_physical_device *physic isl_drm_modifier_info_for_each(isl_mod_info) { VkFormatFeatureFlags2 features2 = - anv_get_image_format_features2(devinfo, vk_format, anv_format, + anv_get_image_format_features2(physical_device, vk_format, anv_format, VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, isl_mod_info); VkFormatFeatureFlags features = vk_format_features2_to_features(features2); @@ -908,7 +908,6 @@ get_drm_format_modifier_properties_list_2(const struct anv_physical_device *phys VkFormat vk_format, VkDrmFormatModifierPropertiesList2EXT *list) { - const struct intel_device_info *devinfo = &physical_device->info; const struct anv_format *anv_format = anv_get_format(vk_format); VK_OUTARRAY_MAKE_TYPED(VkDrmFormatModifierProperties2EXT, out, @@ -917,7 +916,7 @@ get_drm_format_modifier_properties_list_2(const struct anv_physical_device *phys isl_drm_modifier_info_for_each(isl_mod_info) { VkFormatFeatureFlags2 features2 = - anv_get_image_format_features2(devinfo, vk_format, anv_format, + anv_get_image_format_features2(physical_device, vk_format, anv_format, VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, isl_mod_info); if (!features2) @@ -949,9 +948,11 @@ void anv_GetPhysicalDeviceFormatProperties2( assert(pFormatProperties->sType == VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2); VkFormatFeatureFlags2 linear2, optimal2, buffer2; - linear2 = anv_get_image_format_features2(devinfo, vk_format, anv_format, + linear2 = anv_get_image_format_features2(physical_device, vk_format, + anv_format, VK_IMAGE_TILING_LINEAR, NULL); - optimal2 = anv_get_image_format_features2(devinfo, vk_format, anv_format, + optimal2 = anv_get_image_format_features2(physical_device, vk_format, + anv_format, VK_IMAGE_TILING_OPTIMAL, NULL); buffer2 = get_buffer_format_features2(devinfo, vk_format, anv_format); @@ -1120,13 +1121,14 @@ anv_formats_are_compatible( */ static VkFormatFeatureFlags2 anv_formats_gather_format_features( - const struct intel_device_info *devinfo, + const struct anv_physical_device *physical_device, const struct anv_format *format, VkImageTiling tiling, const struct isl_drm_modifier_info *isl_mod_info, const VkImageFormatListCreateInfo *format_list_info, bool allow_texel_compatible) { + const struct intel_device_info *devinfo = &physical_device->info; VkFormatFeatureFlags2KHR all_formats_feature_flags = 0; /* We need to check that each of the usage bits are allowed for at least @@ -1150,7 +1152,7 @@ anv_formats_gather_format_features( devinfo, tiling, allow_texel_compatible)) { VkFormatFeatureFlags2KHR view_format_features = - anv_get_image_format_features2(devinfo, + anv_get_image_format_features2(physical_device, possible_anv_format->vk_format, possible_anv_format, tiling, isl_mod_info); @@ -1169,9 +1171,9 @@ anv_formats_gather_format_features( const struct anv_format *anv_view_format = anv_get_format(vk_view_format); VkFormatFeatureFlags2KHR view_format_features = - anv_get_image_format_features2(devinfo, vk_view_format, - anv_view_format, tiling, - isl_mod_info); + anv_get_image_format_features2(physical_device, + vk_view_format, anv_view_format, + tiling, isl_mod_info); all_formats_feature_flags |= view_format_features; } } @@ -1280,8 +1282,9 @@ anv_get_image_format_properties( * different usage than the image, so we can't always filter on usage. * There is one exception to this below for storage. */ - format_feature_flags = anv_get_image_format_features2(devinfo, info->format, - format, info->tiling, + format_feature_flags = anv_get_image_format_features2(physical_device, + info->format, format, + info->tiling, isl_mod_info); if (!anv_format_supports_usage(format_feature_flags, info->usage)) { @@ -1305,8 +1308,9 @@ anv_get_image_format_properties( * the format list or all the compatible formats. */ VkFormatFeatureFlags2 all_formats_feature_flags = format_feature_flags | - anv_formats_gather_format_features(devinfo, format, info->tiling, - isl_mod_info, format_list_info, + anv_formats_gather_format_features(physical_device, format, + info->tiling, isl_mod_info, + format_list_info, info->flags & VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT); if (!anv_format_supports_usage(all_formats_feature_flags, info->usage)) diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index c6be276716b..42ce629b486 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -4470,7 +4470,7 @@ anv_is_dual_src_blend_equation(const struct vk_color_blend_attachment_state *cb) } VkFormatFeatureFlags2 -anv_get_image_format_features2(const struct intel_device_info *devinfo, +anv_get_image_format_features2(const struct anv_physical_device *physical_device, VkFormat vk_format, const struct anv_format *anv_format, VkImageTiling vk_tiling,
