venus: workaround to consider ALIAS for image mem req cache
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

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
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39368>
This commit is contained in:
Yiwei Zhang 2026-01-16 21:27:13 -08:00 committed by Marge Bot
parent fea23746ce
commit c2c9266fed

View file

@ -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;