From 803a2a9b3d6463ae8ebdd9417fc308abff0cdbc3 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 28 Jun 2021 11:31:50 -0700 Subject: [PATCH] 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 Part-of: --- 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,