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

Author: Tapani Pälli <tapani.pa...@intel.com>
Date:   Tue Nov  7 13:41:41 2023 +0200

anv: skip engine initialization if vm control not supported

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10113
Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Reviewed-by: Sagar Ghuge <sagar.gh...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26091>

---

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

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index b53344a6fb5..3fea16a96d4 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1150,17 +1150,26 @@ 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;
-      if (debug_get_bool_option("INTEL_COMPUTE_CLASS", false))
-         c_count = intel_engines_count(pdevice->engine_info,
-                                       INTEL_ENGINE_CLASS_COMPUTE);
+      const bool can_use_non_render_engines =
+         pdevice->info.kmd_type == INTEL_KMD_TYPE_XE || 
pdevice->has_vm_control;
+      if (debug_get_bool_option("INTEL_COMPUTE_CLASS", false)) {
+         if (!can_use_non_render_engines)
+            mesa_logw("cannot initialize compute engine, no vm control.");
+         else
+            c_count = intel_engines_count(pdevice->engine_info,
+                                          INTEL_ENGINE_CLASS_COMPUTE);
+      }
       enum intel_engine_class compute_class =
          c_count < 1 ? INTEL_ENGINE_CLASS_RENDER : INTEL_ENGINE_CLASS_COMPUTE;
 
       int blit_count = 0;
       if (debug_get_bool_option("INTEL_COPY_CLASS", false) &&
           pdevice->info.verx10 >= 125) {
-         blit_count = intel_engines_count(pdevice->engine_info,
-                                          INTEL_ENGINE_CLASS_COPY);
+         if (!can_use_non_render_engines)
+            mesa_logw("cannot initialize blitter engine, no vm control.");
+         else
+            blit_count = intel_engines_count(pdevice->engine_info,
+                                             INTEL_ENGINE_CLASS_COPY);
       }
 
       anv_override_engine_counts(&gc_count, &g_count, &c_count, &v_count);

Reply via email to