From 9b8fdca8bc992d4415b6cb2d25791d48fcc02e73 Mon Sep 17 00:00:00 2001 From: Jianxun Zhang Date: Thu, 3 Jul 2025 09:47:00 -0700 Subject: [PATCH] anv: Fix PAT entry in importing (xe2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: José Roberto de Souza Reviewed-by: Nanley Chery Part-of: (cherry picked from commit 8d98bf289d5fb9cb50e4c64a54b89201e936b95a) --- .pick_status.json | 2 +- src/intel/vulkan/anv_device.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 3ee4dd1762b..d24b94e7f53 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -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 diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 4c336a63373..4dc065b1a88 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -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;