Skip to content

vkr: do not force chaining VkExternalMemoryImageCreateInfo when tiling is optimal

Yiwei Zhang requested to merge zzyiwei/virglrenderer:dedicated-fix into master

Because of FORCE_ENABLE_DMABUF in vkr_renderer, requiresDedicatedAllocation is set to true from the host driver, while from the guest point of view there isn't external handle type specified for a regular internal image. Then the below constraints are violated:

Constraints on the values returned for image resources are:

  • requiresDedicatedAllocation may be VK_TRUE if the pNext chain of VkImageCreateInfo for the call to vkCreateImage used to create the image being queried included a VkExternalMemoryImageCreateInfo structure, and any of the handle types specified in VkExternalMemoryImageCreateInfo::handleTypes requires dedicated allocation, as reported by vkGetPhysicalDeviceImageFormatProperties2 in VkExternalImageFormatProperties::externalMemoryProperties.externalMemoryFeatures. Otherwise, requiresDedicatedAllocation will be VK_FALSE.

  • If VK_IMAGE_CREATE_SPARSE_BINDING_BIT was set in VkImageCreateInfo::flags when image was created, then both prefersDedicatedAllocation and requiresDedicatedAllocation will be VK_FALSE.

We workaround here to stop chaining VkExternalMemoryImageCreateInfo when the image has VK_IMAGE_TILING_OPTIMAL.

Test: dEQP-VK.memory.requirements.dedicated_allocation.*

/cc @olv

Edited by Yiwei Zhang

Merge request reports