From 42f707e4596f1c6cdbeec2bbbf2a0470080315df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Fri, 26 May 2023 07:12:40 -0700 Subject: [PATCH] intel: Fix support of kernel versions without DRM_I915_QUERY_ENGINE_INFO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As Matt Turner pointed out, the commit here fixed breaks in Iris and ANV in kernel versions without support for DRM_I915_QUERY_ENGINE_INFO. As compute engines are only present in gfx12 and newer, and support for DRM_I915_QUERY_ENGINE_INFO was added before any gfx12 platform, we can check for gfx version before trying to get engine info. For ANV, this is done by checking if engine_info is not NULL, like in other places in the ANV source code. Fixes: a364f23a6cfa ("intel: Make gen12 URB space reservation dependent on compute engine presence") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9099 Signed-off-by: José Roberto de Souza Tested-by: Matt Turner Reviewed-by: Matt Turner Reviewed-by: Marcin Ślusarz Part-of: --- src/gallium/drivers/iris/iris_bufmgr.c | 6 ++---- src/intel/vulkan/anv_device.c | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c index e887773ee62..97ab34bfad9 100644 --- a/src/gallium/drivers/iris/iris_bufmgr.c +++ b/src/gallium/drivers/iris/iris_bufmgr.c @@ -2280,9 +2280,8 @@ iris_bufmgr_create(struct intel_device_info *devinfo, int fd, bool bo_reuse) struct intel_query_engine_info *engine_info; engine_info = intel_engine_get_info(bufmgr->fd, bufmgr->devinfo.kmd_type); - if (!engine_info) - goto error_engine_info; - bufmgr->devinfo.has_compute_engine = intel_engines_count(engine_info, + bufmgr->devinfo.has_compute_engine = engine_info && + intel_engines_count(engine_info, INTEL_ENGINE_CLASS_COMPUTE); free(engine_info); @@ -2378,7 +2377,6 @@ error_slabs_init: } iris_bufmgr_destroy_global_vm(bufmgr); error_init_vm: -error_engine_info: close(bufmgr->fd); error_dup: free(bufmgr); diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index b78db00a4fd..a0cb46b4b3d 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1383,7 +1383,8 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, device->master_fd = master_fd; device->engine_info = intel_engine_get_info(fd, device->info.kmd_type); - device->info.has_compute_engine = intel_engines_count(device->engine_info, + device->info.has_compute_engine = device->engine_info && + intel_engines_count(device->engine_info, INTEL_ENGINE_CLASS_COMPUTE); anv_physical_device_init_queue_families(device);