Module: Mesa
Branch: main
Commit: 99ae565af2b8724ce316d27d7e7382e34aab9a91
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=99ae565af2b8724ce316d27d7e7382e34aab9a91

Author: José Roberto de Souza <jose.so...@intel.com>
Date:   Wed Nov 22 07:36:36 2023 -0800

anv: Prepare anv_device_get_pat_entry() for discrete GPUs

Signed-off-by: José Roberto de Souza <jose.so...@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25462>

---

 src/intel/vulkan/anv_device.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 1be4c158996..3795cadabea 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -5187,6 +5187,16 @@ const struct intel_device_info_pat_entry *
 anv_device_get_pat_entry(struct anv_device *device,
                          enum anv_bo_alloc_flags alloc_flags)
 {
+   /* PAT indexes has no actual effect in DG2 and DG1, smem caches will always
+    * be snopped by GPU and lmem will always be WC.
+    * This might change in future discrete platforms.
+    */
+   if (anv_physical_device_has_vram(device->physical)) {
+      if (alloc_flags & ANV_BO_ALLOC_NO_LOCAL_MEM)
+         return &device->info->pat.cached_coherent;
+      return &device->info->pat.writecombining;
+   }
+
    if (alloc_flags & (ANV_BO_ALLOC_HOST_CACHED_COHERENT))
       return &device->info->pat.cached_coherent;
    else if (alloc_flags & (ANV_BO_ALLOC_EXTERNAL | ANV_BO_ALLOC_SCANOUT))

Reply via email to