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 c2c9266fed)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This commit is contained in:
Yiwei Zhang 2026-01-16 21:27:13 -08:00 committed by Dylan Baker
parent fec205f2ed
commit a39cc49adf
2 changed files with 9 additions and 3 deletions

View file

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

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;