From 63cac09d748d66efeca34da2c213a9cc476345d6 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Sat, 22 Mar 2025 15:45:27 -0700 Subject: [PATCH] venus: improve image memory requirement cache for image aliasing We can strip the alias bit as the memory requirements are identical between the bound image and the aliased image per spec. Acked-by: Dmitry Osipenko Part-of: --- src/virtio/vulkan/vn_image.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/virtio/vulkan/vn_image.c b/src/virtio/vulkan/vn_image.c index 07289ce67a5..3faebc0ee1e 100644 --- a/src/virtio/vulkan/vn_image.c +++ b/src/virtio/vulkan/vn_image.c @@ -97,6 +97,14 @@ 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. */ + VkImageCreateInfo local_info; + if (create_info->flags & VK_IMAGE_CREATE_ALIAS_BIT) { + local_info = *create_info; + local_info.flags &= ~VK_IMAGE_CREATE_ALIAS_BIT; + create_info = &local_info; + } + _mesa_sha1_init(&sha1_ctx); /* Hash relevant fields in the pNext chain */