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

Author: José Roberto de Souza <[email protected]>
Date:   Tue Sep 12 13:30:32 2023 -0700

iris: Change default PAT entry to WC

Iris doesn't make any call to intel_flush_range*() functions so all BOs
created without BO_ALLOC_COHERENT are not coherent between CPU writes
and GPU reads.

A lot of places don't set BO_ALLOC_COHERENT not even command buffers
have it.
And this incoherency is causing most of tests to fail after
the patch that extracted("iris: Calculate iris_mmap_mode using
intel_device_info_pat_entry when possible") the mmap mode from the PAT
entry.

Before that patch MTL was creating BO with a WB PAT index but then
mmaping as WC.

So to fix this for now making the default PAT entry for Iris a WC one.

Signed-off-by: José Roberto de Souza <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25447>

---

 src/gallium/drivers/iris/iris_bufmgr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_bufmgr.c 
b/src/gallium/drivers/iris/iris_bufmgr.c
index e36b204fc68..32477f11db4 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -320,7 +320,8 @@ bucket_for_size(struct iris_bufmgr *bufmgr, uint64_t size,
 
    const struct intel_device_info *devinfo = &bufmgr->devinfo;
    if (devinfo->has_set_pat_uapi &&
-       iris_bufmgr_get_pat_entry_for_bo_flags(bufmgr, flags) != 
&devinfo->pat.writeback)
+       iris_bufmgr_get_pat_entry_for_bo_flags(bufmgr, flags) !=
+       iris_bufmgr_get_pat_entry_for_bo_flags(bufmgr, 0 /* alloc_flags */))
       return NULL;
 
    if (devinfo->kmd_type == INTEL_KMD_TYPE_XE &&
@@ -2632,5 +2633,6 @@ iris_bufmgr_get_pat_entry_for_bo_flags(const struct 
iris_bufmgr *bufmgr,
    if (alloc_flags & (BO_ALLOC_SHARED | BO_ALLOC_SCANOUT))
       return &devinfo->pat.scanout;
 
-   return &devinfo->pat.writeback;
+   /* Iris don't have any clflush() calls so it can't use incoherent WB */
+   return &devinfo->pat.writecombining;
 }

Reply via email to