anv: Fix PAT entry in importing (xe2)

If a compressed bo is imported, we should set the corresponding
compressed PAT.

Fixes video corruption in gamescope:
gamescope --force-composition -- vkcube

Close: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13442

Signed-off-by: Jianxun Zhang <jianxun.zhang@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36275>
(cherry picked from commit 8d98bf289d)
This commit is contained in:
Jianxun Zhang 2025-07-03 09:47:00 -07:00 committed by Eric Engestrom
parent cbd43cd9f8
commit 9b8fdca8bc
2 changed files with 4 additions and 4 deletions

View file

@ -23584,7 +23584,7 @@
"description": "anv: Fix PAT entry in importing (xe2)",
"nominated": false,
"nomination_type": 0,
"resolution": 4,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -2191,9 +2191,6 @@ const struct intel_device_info_pat_entry *
anv_device_get_pat_entry(struct anv_device *device,
enum anv_bo_alloc_flags alloc_flags)
{
if (alloc_flags & ANV_BO_ALLOC_IMPORTED)
return &device->info->pat.cached_coherent;
if (alloc_flags & ANV_BO_ALLOC_COMPRESSED) {
/* Compressed PAT entries are available on Xe2+. */
assert(device->info->ver >= 20);
@ -2202,6 +2199,9 @@ anv_device_get_pat_entry(struct anv_device *device,
&device->info->pat.compressed;
}
if (alloc_flags & ANV_BO_ALLOC_IMPORTED)
return &device->info->pat.cached_coherent;
if (alloc_flags & (ANV_BO_ALLOC_EXTERNAL | ANV_BO_ALLOC_SCANOUT))
return &device->info->pat.scanout;