Mesa (main): iris: Stop calling I915_GEM_SET_CACHING on discrete GPUs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 2 19:17:49 UTC 2021


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Jun 28 11:31:50 2021 -0700

iris: Stop calling I915_GEM_SET_CACHING on discrete GPUs

On integrated GPUs without LLC, we enable snooping when someone requests
coherency for a buffer.  (With LLC, it's already coherent.)

For discrete GPUs...if someone requests coherency, we allocate the
buffer in SMEM and resort to WC maps rather than WB maps with CPU
caches enabled.  There's no snooping to enable, and calling this ioctl
is nonsensical, and may fail.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11644>

---

 src/gallium/drivers/iris/iris_bufmgr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index 7162905ebba..5841fa4a7cf 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -664,7 +664,11 @@ iris_bo_alloc(struct iris_bufmgr *bufmgr,
    assert(bo->map == NULL || bo->mmap_mode == mmap_mode);
    bo->mmap_mode = mmap_mode;
 
-   if ((flags & BO_ALLOC_COHERENT) && !bo->cache_coherent) {
+   /* On integrated GPUs, enable snooping to ensure coherency if needed.
+    * For discrete, we instead use SMEM and avoid WB maps for coherency.
+    */
+   if (bufmgr->vram.size == 0 &&
+       (flags & BO_ALLOC_COHERENT) && !bo->cache_coherent) {
       struct drm_i915_gem_caching arg = {
          .handle = bo->gem_handle,
          .caching = 1,



More information about the mesa-commit mailing list