From 45278d1988a2fcb6996028f0d9bbf18c3c012ba6 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Mon, 3 Apr 2023 04:19:00 -0400 Subject: [PATCH] iris: Use set PAT extension on BO creation for MTL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jordan Justen Reviewed-by: José Roberto de Souza Part-of: --- src/gallium/drivers/iris/i915/iris_kmd_backend.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/iris/i915/iris_kmd_backend.c b/src/gallium/drivers/iris/i915/iris_kmd_backend.c index b56cd36..b1f2c79 100644 --- a/src/gallium/drivers/iris/i915/iris_kmd_backend.c +++ b/src/gallium/drivers/iris/i915/iris_kmd_backend.c @@ -41,7 +41,9 @@ i915_gem_create(struct iris_bufmgr *bufmgr, uint16_t regions_count, uint64_t size, enum iris_heap heap_flags, unsigned alloc_flags) { - if (unlikely(!iris_bufmgr_get_device_info(bufmgr)->mem.use_class_instance)) { + const struct intel_device_info *devinfo = + iris_bufmgr_get_device_info(bufmgr); + if (unlikely(!devinfo->mem.use_class_instance)) { struct drm_i915_gem_create create_legacy = { .size = size }; assert(regions_count == 1 && @@ -77,7 +79,7 @@ i915_gem_create(struct iris_bufmgr *bufmgr, &ext_regions.base); if (iris_bufmgr_vram_size(bufmgr) > 0 && - !intel_vram_all_mappable(iris_bufmgr_get_device_info(bufmgr)) && + !intel_vram_all_mappable(devinfo) && heap_flags == IRIS_HEAP_DEVICE_LOCAL_PREFERRED) create.flags |= I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS; @@ -91,6 +93,16 @@ i915_gem_create(struct iris_bufmgr *bufmgr, &protected_param.base); } + /* Set PAT param */ + struct drm_i915_gem_create_ext_set_pat set_pat_param = { 0 }; + if (devinfo->has_set_pat_uapi) { + set_pat_param.pat_index = + iris_pat_index_for_bo_flags(devinfo, alloc_flags); + intel_gem_add_ext(&create.extensions, + I915_GEM_CREATE_EXT_SET_PAT, + &set_pat_param.base); + } + if (intel_ioctl(iris_bufmgr_get_fd(bufmgr), DRM_IOCTL_I915_GEM_CREATE_EXT, &create)) return 0; -- 2.7.4