From 76aad457a1a2a8bf3c195f149ae65d45a15e3349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Tue, 12 Sep 2023 13:30:32 -0700 Subject: [PATCH] iris: Change default PAT entry to WC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Francisco Jerez Part-of: --- 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; }