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

Author: Paulo Zanoni <paulo.r.zan...@intel.com>
Date:   Mon Nov 13 21:07:33 2023 -0800

anv: enable sparse by default on i915.ko

On i915.ko we don't have the vm_bind ioctl, so sparse requires TR-TT.
Unfortunately, on gfx < 20 TR-TT is not compatible with non-render
queues, so we have to disable those when sparse is enabled. Notice
that although we don't have TR-TT for non-render queues on gfx >= 20,
vm_bind is the default, and it doesn't have this restriction.

Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zan...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25512>

---

 src/intel/vulkan/anv_device.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 404d137e523..a2bcbe647f0 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1151,11 +1151,17 @@ anv_physical_device_init_queue_families(struct 
anv_physical_device *pdevice)
          intel_engines_count(pdevice->engine_info, INTEL_ENGINE_CLASS_VIDEO);
       int g_count = 0;
       int c_count = 0;
-      const bool can_use_non_render_engines =
+      const bool kernel_supports_non_render_engines =
          pdevice->info.kmd_type == INTEL_KMD_TYPE_XE || 
pdevice->has_vm_control;
+      const bool sparse_supports_non_render_engines =
+         !pdevice->has_sparse || !pdevice->sparse_uses_trtt;
+      const bool can_use_non_render_engines =
+         kernel_supports_non_render_engines &&
+         sparse_supports_non_render_engines;
+
       if (debug_get_bool_option("INTEL_COMPUTE_CLASS", false)) {
          if (!can_use_non_render_engines)
-            mesa_logw("cannot initialize compute engine, no vm control.");
+            mesa_logw("cannot initialize compute engine");
          else
             c_count = intel_engines_count(pdevice->engine_info,
                                           INTEL_ENGINE_CLASS_COMPUTE);
@@ -1167,7 +1173,7 @@ anv_physical_device_init_queue_families(struct 
anv_physical_device *pdevice)
       if (debug_get_bool_option("INTEL_COPY_CLASS", false) &&
           pdevice->info.verx10 >= 125) {
          if (!can_use_non_render_engines)
-            mesa_logw("cannot initialize blitter engine, no vm control.");
+            mesa_logw("cannot initialize blitter engine");
          else
             blit_count = intel_engines_count(pdevice->engine_info,
                                              INTEL_ENGINE_CLASS_COPY);
@@ -1453,7 +1459,7 @@ anv_physical_device_try_create(struct vk_instance 
*vk_instance,
       device->has_sparse =
          device->info.ver >= 12 &&
          device->has_exec_timeline &&
-         debug_get_bool_option("ANV_SPARSE", false);
+         debug_get_bool_option("ANV_SPARSE", true);
       device->sparse_uses_trtt = true;
    }
 

Reply via email to