mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
panvk: implement check_status on v10+
vk_common_*Wait* calls vk_device_check_status to detect device lost. This allows device lost to be reported more timely. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32166>
This commit is contained in:
parent
a52ffa9f24
commit
1be7e2e89d
6 changed files with 60 additions and 0 deletions
|
|
@ -69,4 +69,6 @@ VkResult panvk_per_arch(queue_init)(struct panvk_device *device,
|
|||
struct panvk_queue *queue, int idx,
|
||||
const VkDeviceQueueCreateInfo *create_info);
|
||||
|
||||
VkResult panvk_per_arch(queue_check_status)(struct panvk_queue *queue);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
29
src/panfrost/vulkan/csf/panvk_vX_device.c
Normal file
29
src/panfrost/vulkan/csf/panvk_vX_device.c
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright © 2024 Collabora Ltd.
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "panvk_device.h"
|
||||
#include "panvk_queue.h"
|
||||
|
||||
VkResult
|
||||
panvk_per_arch(device_check_status)(struct vk_device *vk_dev)
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(vk_dev);
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
for (uint32_t qfi = 0; qfi < PANVK_MAX_QUEUE_FAMILIES; qfi++) {
|
||||
for (uint32_t q = 0; q < dev->queue_count[qfi]; q++) {
|
||||
struct panvk_queue *queue = &dev->queues[qfi][q];
|
||||
if (panvk_per_arch(queue_check_status)(queue) != VK_SUCCESS)
|
||||
result = VK_ERROR_DEVICE_LOST;
|
||||
}
|
||||
}
|
||||
|
||||
if (pan_kmod_vm_query_state(dev->kmod.vm) != PAN_KMOD_VM_USABLE) {
|
||||
vk_device_set_lost(&dev->vk, "vm state: not usable");
|
||||
result = VK_ERROR_DEVICE_LOST;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -779,3 +779,23 @@ panvk_per_arch(queue_finish)(struct panvk_queue *queue)
|
|||
drmSyncobjDestroy(dev->vk.drm_fd, queue->syncobj_handle);
|
||||
vk_queue_finish(&queue->vk);
|
||||
}
|
||||
|
||||
VkResult
|
||||
panvk_per_arch(queue_check_status)(struct panvk_queue *queue)
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(queue->vk.base.device);
|
||||
struct drm_panthor_group_get_state state = {
|
||||
.group_handle = queue->group_handle,
|
||||
};
|
||||
|
||||
int ret =
|
||||
drmIoctl(dev->vk.drm_fd, DRM_IOCTL_PANTHOR_GROUP_GET_STATE, &state);
|
||||
if (!ret && !state.state)
|
||||
return VK_SUCCESS;
|
||||
|
||||
vk_queue_set_lost(&queue->vk,
|
||||
"group state: err=%d, state=0x%x, fatal_queues=0x%x", ret,
|
||||
state.state, state.fatal_queues);
|
||||
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ csf_files = [
|
|||
'csf/panvk_vX_cmd_draw.c',
|
||||
'csf/panvk_vX_cmd_event.c',
|
||||
'csf/panvk_vX_cmd_query.c',
|
||||
'csf/panvk_vX_device.c',
|
||||
'csf/panvk_vX_event.c',
|
||||
'csf/panvk_vX_queue.c',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -90,6 +90,11 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device,
|
|||
|
||||
void panvk_per_arch(destroy_device)(struct panvk_device *device,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
#if PAN_ARCH >= 10
|
||||
VkResult panvk_per_arch(device_check_status)(struct vk_device *vk_dev);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -250,6 +250,9 @@ panvk_per_arch(create_device)(struct panvk_physical_device *physical_device,
|
|||
device->vk.command_dispatch_table = &device->cmd_dispatch;
|
||||
device->vk.command_buffer_ops = &panvk_per_arch(cmd_buffer_ops);
|
||||
device->vk.shader_ops = &panvk_per_arch(device_shader_ops);
|
||||
#if PAN_ARCH >= 10
|
||||
device->vk.check_status = panvk_per_arch(device_check_status);
|
||||
#endif
|
||||
|
||||
device->kmod.allocator = (struct pan_kmod_allocator){
|
||||
.zalloc = panvk_kmod_zalloc,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue