From: José Roberto de Souza Date: Thu, 9 Feb 2023 20:34:50 +0000 (-0800) Subject: anv: Implement Xe version of check_status() X-Git-Tag: upstream/23.3.3~11221 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45cb2819f6a27f999918594a770a6fdb76b6faeb;p=platform%2Fupstream%2Fmesa.git anv: Implement Xe version of check_status() Signed-off-by: José Roberto de Souza Reviewed-by: Lionel Landwerlin Part-of: --- diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index b457b54..022cd53 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -3036,8 +3036,18 @@ VkResult anv_CreateDevice( goto fail_device; } + switch (device->info->kmd_type) { + case INTEL_KMD_TYPE_I915: + device->vk.check_status = anv_i915_device_check_status; + break; + case INTEL_KMD_TYPE_XE: + device->vk.check_status = anv_xe_device_check_status; + break; + default: + unreachable("Missing"); + } + device->vk.command_buffer_ops = &anv_cmd_buffer_ops; - device->vk.check_status = anv_i915_device_check_status; device->vk.create_sync_for_memory = anv_create_sync_for_memory; vk_device_set_drm_fd(&device->vk, device->fd); diff --git a/src/intel/vulkan/xe/anv_device.c b/src/intel/vulkan/xe/anv_device.c index bc3afb2..5414bee 100644 --- a/src/intel/vulkan/xe/anv_device.c +++ b/src/intel/vulkan/xe/anv_device.c @@ -55,3 +55,26 @@ anv_xe_physical_device_get_parameters(struct anv_physical_device *device) return VK_SUCCESS; } + +VkResult +anv_xe_device_check_status(struct vk_device *vk_device) +{ + struct anv_device *device = container_of(vk_device, struct anv_device, vk); + VkResult result = VK_SUCCESS; + + for (uint32_t i = 0; i < device->queue_count; i++) { + struct drm_xe_engine_get_property engine_get_property = { + .engine_id = device->queues[i].engine_id, + .property = XE_ENGINE_GET_PROPERTY_BAN, + }; + int ret = intel_ioctl(device->fd, DRM_IOCTL_XE_ENGINE_GET_PROPERTY, + &engine_get_property); + + if (ret || engine_get_property.value) { + result = vk_device_set_lost(&device->vk, "One or more queues banned"); + break; + } + } + + return result; +} diff --git a/src/intel/vulkan/xe/anv_device.h b/src/intel/vulkan/xe/anv_device.h index 026f5aa..6f290e5 100644 --- a/src/intel/vulkan/xe/anv_device.h +++ b/src/intel/vulkan/xe/anv_device.h @@ -25,12 +25,14 @@ #include #include "vulkan/vulkan_core.h" +#include "vk_device.h" struct anv_device; struct anv_physical_device; bool anv_xe_device_destroy_vm(struct anv_device *device); VkResult anv_xe_device_setup_vm(struct anv_device *device); +VkResult anv_xe_device_check_status(struct vk_device *vk_device); VkResult anv_xe_physical_device_get_parameters(struct anv_physical_device *device);