venus: strip ALIAS_BIT for WSI image creation on ANV

For compositors that advertise modifier support, Vulkan common WSI
modifier support queries still fail in Venus on the Intel ANV driver.

This is due to the presence of VK_CREATE_IMAGE_ALIAS_BIT, without
accompanying wsi_image_create_info struct, which is implicitly excluded
from serialized messages over the venus-protocol.

By removing ALIAS_BIT, modifier queries begin to pass when the host
supports them.

Signed-off-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26240>
This commit is contained in:
Ryan Neph
2023-11-08 11:12:23 -08:00
committed by Marge Bot
parent 9bde89591e
commit 833d228f53
2 changed files with 25 additions and 5 deletions
+17 -2
View File
@@ -2023,12 +2023,13 @@ vn_GetPhysicalDeviceImageFormatProperties2(
const VkExternalMemoryHandleTypeFlags supported_handle_types =
physical_dev->external_memory.supported_handle_types;
const struct wsi_image_create_info *wsi_info = vk_find_struct_const(
pImageFormatInfo->pNext, WSI_IMAGE_CREATE_INFO_MESA);
/* force common wsi into choosing DRM_FORMAT_MOD_LINEAR or else fall back
* to the legacy path, for which Venus also forces LINEAR for wsi images.
*/
if (VN_PERF(NO_TILED_WSI_IMAGE)) {
const struct wsi_image_create_info *wsi_info = vk_find_struct_const(
pImageFormatInfo->pNext, WSI_IMAGE_CREATE_INFO_MESA);
const VkPhysicalDeviceImageDrmFormatModifierInfoEXT *modifier_info =
vk_find_struct_const(
pImageFormatInfo->pNext,
@@ -2088,6 +2089,20 @@ vn_GetPhysicalDeviceImageFormatProperties2(
}
}
/* Since venus-protocol doesn't pass the wsi_image_create_info struct, we
* must remove the ALIAS_BIT here and in vn_wsi_create_image().
* ANV rejects the bit for external+nonlinear images that don't have WSI
* info chained.
*/
if (wsi_info && physical_dev->renderer_driver_id ==
VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA) {
if (pImageFormatInfo != &local_info.format) {
local_info.format = *pImageFormatInfo;
pImageFormatInfo = &local_info.format;
}
local_info.format.flags &= ~VK_IMAGE_CREATE_ALIAS_BIT;
}
VkResult result;
/* TODO per-device cache */
result = vn_call_vkGetPhysicalDeviceImageFormatProperties2(
+8 -3
View File
@@ -122,15 +122,14 @@ vn_wsi_create_image(struct vn_device *dev,
.drmFormatModifierCount = 1,
.pDrmFormatModifiers = &modifier,
};
VkImageCreateInfo local_create_info;
VkImageCreateInfo local_create_info = *create_info;
create_info = &local_create_info;
if (wsi_info->scanout) {
assert(!vk_find_struct_const(
create_info->pNext, IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT));
local_create_info = *create_info;
local_create_info.pNext = &mod_list_info;
local_create_info.tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
create_info = &local_create_info;
if (VN_DEBUG(WSI)) {
vn_log(
@@ -138,6 +137,12 @@ vn_wsi_create_image(struct vn_device *dev,
"forcing scanout image linear (no explicit modifier support)");
}
} else {
if (dev->physical_device->renderer_driver_id ==
VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA) {
/* See explanation in vn_GetPhysicalDeviceImageFormatProperties2() */
local_create_info.flags &= ~VK_IMAGE_CREATE_ALIAS_BIT;
}
if (VN_PERF(NO_TILED_WSI_IMAGE)) {
const VkImageDrmFormatModifierListCreateInfoEXT *modifier_info =
vk_find_struct_const(