anv: pass image usage/flags to anv_get_image_format_features2
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: mesa-stable Reviewed-by: Nanley Chery <nanley.g.chery@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35358>
This commit is contained in:
committed by
Marge Bot
parent
befc2a2f62
commit
bd959ea48f
@@ -189,7 +189,8 @@ get_ahw_buffer_format_properties2(
|
||||
|
||||
p->formatFeatures =
|
||||
anv_get_image_format_features2(device->physical, p->format, anv_format,
|
||||
tiling, false /* is_sparse */, NULL);
|
||||
tiling, 0 /* usage */, 0 /* flags */,
|
||||
NULL);
|
||||
|
||||
/* "Images can be created with an external format even if the Android hardware
|
||||
* buffer has a format which has an equivalent Vulkan format to enable
|
||||
|
||||
@@ -634,11 +634,16 @@ anv_get_image_format_features2(const struct anv_physical_device *physical_device
|
||||
VkFormat vk_format,
|
||||
const struct anv_format *anv_format,
|
||||
VkImageTiling vk_tiling,
|
||||
bool is_sparse,
|
||||
VkImageUsageFlags usage,
|
||||
VkImageCreateFlags create_flags,
|
||||
const struct isl_drm_modifier_info *isl_mod_info)
|
||||
{
|
||||
const struct intel_device_info *devinfo = &physical_device->info;
|
||||
VkFormatFeatureFlags2 flags = 0;
|
||||
const bool is_sparse = (create_flags &
|
||||
(VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
|
||||
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT |
|
||||
VK_IMAGE_CREATE_SPARSE_ALIASED_BIT)) != 0;
|
||||
|
||||
if (anv_format == NULL)
|
||||
return 0;
|
||||
@@ -1069,7 +1074,7 @@ get_drm_format_modifier_properties_list(const struct anv_physical_device *physic
|
||||
VkFormatFeatureFlags2 features2 =
|
||||
anv_get_image_format_features2(physical_device, vk_format, anv_format,
|
||||
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT,
|
||||
false /* is_sparse */,
|
||||
0 /* usage */, 0 /* create_flags */,
|
||||
isl_mod_info);
|
||||
VkFormatFeatureFlags features = vk_format_features2_to_features(features2);
|
||||
if (!features)
|
||||
@@ -1105,7 +1110,7 @@ get_drm_format_modifier_properties_list_2(const struct anv_physical_device *phys
|
||||
VkFormatFeatureFlags2 features2 =
|
||||
anv_get_image_format_features2(physical_device, vk_format, anv_format,
|
||||
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT,
|
||||
false /* is_sparse */,
|
||||
0 /* usage */, 0 /* create_flags */,
|
||||
isl_mod_info);
|
||||
if (!features2)
|
||||
continue;
|
||||
@@ -1138,10 +1143,12 @@ void anv_GetPhysicalDeviceFormatProperties2(
|
||||
VkFormatFeatureFlags2 linear2, optimal2, buffer2;
|
||||
linear2 = anv_get_image_format_features2(physical_device, vk_format,
|
||||
anv_format, VK_IMAGE_TILING_LINEAR,
|
||||
false /* is_sparse */, NULL);
|
||||
0 /* usage */,
|
||||
0 /* create_flags */, NULL);
|
||||
optimal2 = anv_get_image_format_features2(physical_device, vk_format,
|
||||
anv_format, VK_IMAGE_TILING_OPTIMAL,
|
||||
false /* is_sparse */, NULL);
|
||||
0 /* usage */,
|
||||
0 /* create_flags */, NULL);
|
||||
buffer2 = get_buffer_format_features2(physical_device, vk_format, anv_format);
|
||||
|
||||
pFormatProperties->formatProperties = (VkFormatProperties) {
|
||||
@@ -1323,8 +1330,11 @@ anv_formats_gather_format_features(
|
||||
VkImageTiling tiling,
|
||||
const struct isl_drm_modifier_info *isl_mod_info,
|
||||
const VkImageFormatListCreateInfo *format_list_info,
|
||||
bool allow_texel_compatible)
|
||||
VkImageUsageFlags usage,
|
||||
VkImageCreateFlags create_flags)
|
||||
{
|
||||
const bool allow_texel_compatible =
|
||||
(create_flags & VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT) != 0;
|
||||
VkFormatFeatureFlags2 all_formats_feature_flags = 0;
|
||||
|
||||
/* We need to check that each of the usage bits are allowed for at least
|
||||
@@ -1351,7 +1361,7 @@ anv_formats_gather_format_features(
|
||||
anv_get_image_format_features2(physical_device,
|
||||
possible_anv_format->vk_format,
|
||||
possible_anv_format, tiling,
|
||||
false /* is_sparse */,
|
||||
usage, create_flags,
|
||||
isl_mod_info);
|
||||
all_formats_feature_flags |= view_format_features;
|
||||
}
|
||||
@@ -1370,7 +1380,7 @@ anv_formats_gather_format_features(
|
||||
VkFormatFeatureFlags2 view_format_features =
|
||||
anv_get_image_format_features2(physical_device,
|
||||
vk_view_format, anv_view_format,
|
||||
tiling, false /* is_sparse */,
|
||||
tiling, usage, create_flags,
|
||||
isl_mod_info);
|
||||
all_formats_feature_flags |= view_format_features;
|
||||
}
|
||||
@@ -1434,7 +1444,6 @@ static VkResult
|
||||
anv_get_image_format_properties(
|
||||
struct anv_physical_device *physical_device,
|
||||
const VkPhysicalDeviceImageFormatInfo2 *info,
|
||||
bool is_sparse,
|
||||
VkImageFormatProperties2 *props)
|
||||
{
|
||||
VkFormatFeatureFlags2 format_feature_flags;
|
||||
@@ -1599,7 +1608,8 @@ anv_get_image_format_properties(
|
||||
format_feature_flags = anv_get_image_format_features2(physical_device,
|
||||
info->format, format,
|
||||
info->tiling,
|
||||
is_sparse,
|
||||
info->usage,
|
||||
info->flags,
|
||||
isl_mod_info);
|
||||
|
||||
if (!anv_format_supports_usage(format_feature_flags, info->usage)) {
|
||||
@@ -1632,7 +1642,8 @@ anv_get_image_format_properties(
|
||||
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);
|
||||
info->usage,
|
||||
info->flags);
|
||||
|
||||
if (!anv_format_supports_usage(all_formats_feature_flags, info->usage))
|
||||
goto unsupported;
|
||||
@@ -2010,7 +2021,6 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2(
|
||||
|
||||
return anv_get_image_format_properties(physical_device,
|
||||
pImageFormatInfo,
|
||||
false /* is_sparse */,
|
||||
pImageFormatProperties);
|
||||
}
|
||||
|
||||
@@ -2047,8 +2057,7 @@ void anv_GetPhysicalDeviceSparseImageFormatProperties2(
|
||||
};
|
||||
VkImageFormatProperties2 img_props = {};
|
||||
if (anv_get_image_format_properties(physical_device,
|
||||
&img_info, true /* is_sparse */,
|
||||
&img_props) != VK_SUCCESS)
|
||||
&img_info, &img_props) != VK_SUCCESS)
|
||||
return;
|
||||
|
||||
if ((pFormatInfo->samples &
|
||||
|
||||
@@ -6302,7 +6302,8 @@ anv_get_image_format_features2(const struct anv_physical_device *physical_device
|
||||
VkFormat vk_format,
|
||||
const struct anv_format *anv_format,
|
||||
VkImageTiling vk_tiling,
|
||||
bool is_sparse,
|
||||
VkImageUsageFlags usage,
|
||||
VkImageCreateFlags create_flags,
|
||||
const struct isl_drm_modifier_info *isl_mod_info);
|
||||
|
||||
void anv_fill_buffer_surface_state(struct anv_device *device,
|
||||
|
||||
Reference in New Issue
Block a user