From 36bc3da58636be8e2aff75f0a77058ecdb37e01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Thu, 22 Jun 2023 13:52:27 -0700 Subject: [PATCH] iris: Move i915_gem_set_domain() call to i915 backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was being called from the common code, so it was being executed for Xe KMD. Luckily Xe don't have any uAPI at 0x1f offset. There is still one user of i915_gem_set_domain() in iris_bufmgr.c so it was duplicated in i915 backend but a future patch in this series will take to remove it when the userptr code moves to backend. Signed-off-by: José Roberto de Souza Reviewed-by: Marcin Ślusarz Reviewed-by: Lionel Landwerlin Part-of: --- .../drivers/iris/i915/iris_kmd_backend.c | 20 +++++++++++++++++++ src/gallium/drivers/iris/iris_bufmgr.c | 7 ------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/iris/i915/iris_kmd_backend.c b/src/gallium/drivers/iris/i915/iris_kmd_backend.c index d2b8c482010..207c88b077e 100644 --- a/src/gallium/drivers/iris/i915/iris_kmd_backend.c +++ b/src/gallium/drivers/iris/i915/iris_kmd_backend.c @@ -36,6 +36,19 @@ #define FILE_DEBUG_FLAG DEBUG_BUFMGR +static int +i915_gem_set_domain(struct iris_bufmgr *bufmgr, uint32_t handle, + uint32_t read_domains, uint32_t write_domains) +{ + struct drm_i915_gem_set_domain sd = { + .handle = handle, + .read_domains = read_domains, + .write_domain = write_domains, + }; + return intel_ioctl(iris_bufmgr_get_fd(bufmgr), + DRM_IOCTL_I915_GEM_SET_DOMAIN, &sd); +} + static uint32_t i915_gem_create(struct iris_bufmgr *bufmgr, const struct intel_memory_class_instance **regions, @@ -108,6 +121,13 @@ i915_gem_create(struct iris_bufmgr *bufmgr, &create)) return 0; + if (iris_bufmgr_vram_size(bufmgr) == 0) + /* Calling set_domain() will allocate pages for the BO outside of the + * struct mutex lock in the kernel, which is more efficient than waiting + * to create them during the first execbuf that uses the BO. + */ + i915_gem_set_domain(bufmgr, create.handle, I915_GEM_DOMAIN_CPU, 0); + return create.handle; } diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index f1f58861e0f..316d09f2ed2 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -1123,13 +1123,6 @@ alloc_fresh_bo(struct iris_bufmgr *bufmgr, uint64_t bo_size, unsigned flags) bo->size = bo_size; bo->idle = true; - if (bufmgr->vram.size == 0) - /* Calling set_domain() will allocate pages for the BO outside of the - * struct mutex lock in the kernel, which is more efficient than waiting - * to create them during the first execbuf that uses the BO. - */ - i915_gem_set_domain(bufmgr, bo->gem_handle, I915_GEM_DOMAIN_CPU, 0); - return bo; }