mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
anv/image: Refactor iteration over modifiers
Refactor in get_wsi_format_modifier_properties_list().
Instead of iterating over a function-local hard-coded list, iterate over
all modifiers in isl_drm.c.
This will improve agreement in behavior between
VkDrmFormatModifierPropertiesListEXT
VkPhysicalDeviceImageDrmFormatModifierInfoEXT.
The future disagreement this patch attempts to prevent is the
combination of:
a. VkDrmFormatModifierPropertiesListEXT neglects to return a valid
modifier because its hard-coded list of modifiers drifts
out-of-sync with hard-coded lists elsewhere in the code. (Already
today, the list in get_wsi_format_modifier_properties_list() does
not match the list in isl_drm.c; though, this has produced no bug
yet).
b. vkGetPhysicalDeviceImageFormatProperties2 accepts, via
VkPhysicalDeviceImageDrmFormatModifierInfoEXT, the modifier
overlooked in (a), because it does not use the same hard-coded
list in get_wsi_format_modifier_properties_list(). (Recall that
the spec requires vkGetPhysicalDeviceImageFormatProperties2 to
correctly accept/reject any int that the app provides, even when
the int is an invalid modifier).
c. The Bug. The driver told the app in (b) that it can legally
create an image with format+modifier, but the app cannot query
the VkFormatFeatureFlags of the format+modifier due to (a).
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
6835cb7f86
commit
146f41e608
1 changed files with 1 additions and 14 deletions
|
|
@ -833,20 +833,7 @@ get_wsi_format_modifier_properties_list(const struct anv_physical_device *physic
|
|||
vk_format == VK_FORMAT_B8G8R8A8_SRGB ||
|
||||
vk_format == VK_FORMAT_B8G8R8A8_UNORM);
|
||||
|
||||
uint64_t modifiers[] = {
|
||||
DRM_FORMAT_MOD_LINEAR,
|
||||
I915_FORMAT_MOD_X_TILED,
|
||||
I915_FORMAT_MOD_Y_TILED,
|
||||
I915_FORMAT_MOD_Y_TILED_CCS,
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(modifiers); i++) {
|
||||
const struct isl_drm_modifier_info *isl_mod_info =
|
||||
isl_drm_modifier_get_info(modifiers[i]);
|
||||
|
||||
if (!isl_mod_info)
|
||||
continue;
|
||||
|
||||
isl_drm_modifier_info_for_each(isl_mod_info) {
|
||||
VkFormatFeatureFlags features =
|
||||
anv_get_image_format_features(devinfo, vk_format, anv_format,
|
||||
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue