smithay icon indicating copy to clipboard operation
smithay copied to clipboard

Vulkan allocator doesn't support implicit modifiers

Open ids1024 opened this issue 1 year ago • 1 comments

Running anvil --x11 in a Gnome X session, it seems to fail to allocate buffers (at least on this particular hardware/driver). Looking into it, it seems the only modifiers it find available are Invalid, meaning implicit modifiers, which is filtered out in filter_modifiers.

ids1024 avatar Oct 03 '23 21:10 ids1024

I believe that VK_EXT_image_drm_format_modifier does not support INVALID as a modifier per the following:

VkImageDrmFormatModifierExplicitCreateInfoEXT:

VUID-VkImageDrmFormatModifierExplicitCreateInfoEXT-drmFormatModifier-02264

drmFormatModifier must be compatible with the parameters in VkImageCreateInfo and its pNext chain, as determined by querying VkPhysicalDeviceImageFormatInfo2 extended with VkPhysicalDeviceImageDrmFormatModifierInfoEXT

VkImageDrmFormatModifierListCreateInfoEXT

VUID-VkImageDrmFormatModifierListCreateInfoEXT-pDrmFormatModifiers-02263

Each modifier in pDrmFormatModifiers must be compatible with the parameters in VkImageCreateInfo and its pNext chain, as determined by querying VkPhysicalDeviceImageFormatInfo2 extended with VkPhysicalDeviceImageDrmFormatModifierInfoEXT

These statements are quite simple: Only use modifiers supported by the format based on info you can query.

So then let's look at VkPhysicalDeviceImageDrmFormatModifierInfoEXT. This returns a list of VkDrmFormatModifierPropertiesEXT containing info for each modifier supported by a format.

Quoting from the description of VkDrmFormatModifierPropertiesEXT

The implementation must not return DRM_FORMAT_MOD_INVALID in drmFormatModifier.

This means that Vulkan at the moment must reject an invalid format modifier, or that using an invalid modifier is undefined behavior.

i509VCB avatar Oct 04 '23 01:10 i509VCB