Skip to content

Commit

Permalink
intel: Fix support of kernel versions without DRM_I915_QUERY_ENGINE_INFO
Browse files Browse the repository at this point in the history
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: a364f23 ("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 <[email protected]>
Tested-by: Matt Turner <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Marcin Ślusarz <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23257>
(cherry picked from commit 42f707e)
  • Loading branch information
zehortigoza authored and 1ace committed Jun 2, 2023
1 parent a64cb5c commit 0fd5043
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pick_status.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
"description": "intel: Fix support of kernel versions without DRM_I915_QUERY_ENGINE_INFO",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "a364f23a6cfa28e1843ef1e64dce56b4cef5a71e"
},
Expand Down
6 changes: 2 additions & 4 deletions src/gallium/drivers/iris/iris_bufmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2240,9 +2240,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);

Expand Down Expand Up @@ -2338,7 +2337,6 @@ iris_bufmgr_create(struct intel_device_info *devinfo, int fd, bool bo_reuse)
}
iris_bufmgr_destroy_global_vm(bufmgr);
error_init_vm:
error_engine_info:
close(bufmgr->fd);
error_dup:
free(bufmgr);
Expand Down
3 changes: 2 additions & 1 deletion src/intel/vulkan/anv_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,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);

Expand Down

0 comments on commit 0fd5043

Please sign in to comment.