From a39cc49adf9e9b6708f11dd58f9735871fa243ab Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Fri, 16 Jan 2026 21:27:13 -0800 Subject: [PATCH] venus: workaround to consider ALIAS for image mem req cache ANV can return different memory requirements with and w/o the ALIAS bit. See https://gitlab.freedesktop.org/mesa/mesa/-/issues/14671 for details. Meanwhile, venus has a driver side cache for image memory requirements. As blessed per spec for memory aliasing, venus strips the ALIAS bit when populating the cache key. Because of the use of imageless mem req query, the ALIAS mem req now can hit the cache first, leaving a smaller/relaxed requirement in the cache...busted. Venus is unable to fix ANV behavior behind the scene, so this workaround is only to align Venus behavior with ANV to not suffer from Venus-only rendering artifacts. Cc: mesa-stable (cherry picked from commit c2c9266fedde7b0733ca4511e6037a2f44b7550f) Part-of: --- .pick_status.json | 2 +- src/virtio/vulkan/vn_image.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index bf39725e12d..36a95994c68 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1274,7 +1274,7 @@ "description": "venus: workaround to consider ALIAS for image mem req cache", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/virtio/vulkan/vn_image.c b/src/virtio/vulkan/vn_image.c index 97bf2e8609e..0b07094e18a 100644 --- a/src/virtio/vulkan/vn_image.c +++ b/src/virtio/vulkan/vn_image.c @@ -97,9 +97,15 @@ vn_image_get_image_reqs_key(struct vn_device *dev, if (!dev->image_reqs_cache.ht) return false; - /* Strip the alias bit as the memory requirements are identical. */ + /* Strip the alias bit as the memory requirements are identical. + * + * Except on: + * - ANV: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14671 + */ VkImageCreateInfo local_info; - if (create_info->flags & VK_IMAGE_CREATE_ALIAS_BIT) { + if ((create_info->flags & VK_IMAGE_CREATE_ALIAS_BIT) && + (dev->physical_device->renderer_driver_id != + VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA)) { local_info = *create_info; local_info.flags &= ~VK_IMAGE_CREATE_ALIAS_BIT; create_info = &local_info;