diff options
author | Hyunjun Ko <zzoon@igalia.com> | 2021-11-18 04:05:27 +0000 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-01-13 04:01:44 +0000 |
commit | f976f71fb08c47e2d3c52fb85b09a933f95740ba (patch) | |
tree | 3af1c1ca2efc4134a157e5b41a2b9b65bb9d2c11 | |
parent | 14a4600b62d33dc8fd8268678fe8c5b0daa04b69 (diff) |
turnip: Use the new common device lost tracking
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14105>
-rw-r--r-- | src/freedreno/vulkan/tu_device.c | 24 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_drm.c | 6 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_kgsl.c | 4 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_private.h | 12 | ||||
-rw-r--r-- | src/freedreno/vulkan/tu_query.c | 2 |
5 files changed, 7 insertions, 41 deletions
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index 43e75f9b672..b86404f37ac 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -1569,7 +1569,6 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice, device->instance = physical_device->instance; device->physical_device = physical_device; device->fd = physical_device->local_fd; - device->_lost = false; mtx_init(&device->bo_mutex, mtx_plain); pthread_mutex_init(&device->submit_mutex, NULL); @@ -1819,27 +1818,6 @@ tu_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator) } VkResult -_tu_device_set_lost(struct tu_device *device, - const char *msg, ...) -{ - /* Set the flag indicating that waits should return in finite time even - * after device loss. - */ - p_atomic_inc(&device->_lost); - - /* TODO: Report the log message through VkDebugReportCallbackEXT instead */ - va_list ap; - va_start(ap, msg); - mesa_loge_v(msg, ap); - va_end(ap); - - if (env_var_as_boolean("TU_ABORT_ON_DEVICE_LOSS", false)) - abort(); - - return VK_ERROR_DEVICE_LOST; -} - -VkResult tu_get_scratch_bo(struct tu_device *dev, uint64_t size, struct tu_bo **bo) { unsigned size_log2 = MAX2(util_logbase2_ceil64(size), MIN_SCRATCH_BO_SIZE_LOG2); @@ -1898,7 +1876,7 @@ tu_QueueWaitIdle(VkQueue _queue) { TU_FROM_HANDLE(tu_queue, queue, _queue); - if (tu_device_is_lost(queue->device)) + if (vk_device_is_lost(&queue->device->vk)) return VK_ERROR_DEVICE_LOST; if (queue->fence < 0) diff --git a/src/freedreno/vulkan/tu_drm.c b/src/freedreno/vulkan/tu_drm.c index 624112fff01..7dc3aaa8dc5 100644 --- a/src/freedreno/vulkan/tu_drm.c +++ b/src/freedreno/vulkan/tu_drm.c @@ -1189,7 +1189,7 @@ tu_queue_submit_locked(struct tu_queue *queue, struct tu_queue_submit *submit) mtx_unlock(&queue->device->bo_mutex); if (ret) - return tu_device_set_lost(queue->device, "submit failed: %s\n", + return vk_device_set_lost(&queue->device->vk, "submit failed: %s\n", strerror(errno)); /* restore permanent payload on wait */ @@ -1570,7 +1570,7 @@ tu_WaitForFences(VkDevice _device, { TU_FROM_HANDLE(tu_device, device, _device); - if (tu_device_is_lost(device)) + if (vk_device_is_lost(&device->vk)) return VK_ERROR_DEVICE_LOST; uint32_t handles[fenceCount]; @@ -1600,7 +1600,7 @@ tu_ResetFences(VkDevice _device, uint32_t fenceCount, const VkFence *pFences) .count_handles = fenceCount, }); if (ret) { - tu_device_set_lost(device, "DRM_IOCTL_SYNCOBJ_RESET failure: %s", + vk_device_set_lost(&device->vk, "DRM_IOCTL_SYNCOBJ_RESET failure: %s", strerror(errno)); } diff --git a/src/freedreno/vulkan/tu_kgsl.c b/src/freedreno/vulkan/tu_kgsl.c index 2017a0a130e..eaf23d04430 100644 --- a/src/freedreno/vulkan/tu_kgsl.c +++ b/src/freedreno/vulkan/tu_kgsl.c @@ -432,7 +432,7 @@ tu_QueueSubmit(VkQueue _queue, int ret = safe_ioctl(queue->device->physical_device->local_fd, IOCTL_KGSL_GPU_COMMAND, &req); if (ret) { - result = tu_device_set_lost(queue->device, + result = vk_device_set_lost(&queue->device->vk, "submit failed: %s\n", strerror(errno)); goto fail; } @@ -447,7 +447,7 @@ tu_QueueSubmit(VkQueue _queue, if (i == submitCount - 1) { int fd = timestamp_to_fd(queue, req.timestamp); if (fd < 0) { - result = tu_device_set_lost(queue->device, + result = vk_device_set_lost(&queue->device->vk, "Failed to create sync file for timestamp: %s\n", strerror(errno)); goto fail; diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index 163ae273959..a71e5985f2e 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -379,7 +379,6 @@ struct tu_device struct tu_physical_device *physical_device; int fd; - int _lost; struct ir3_compiler *compiler; @@ -452,17 +451,6 @@ void tu_init_clear_blit_shaders(struct tu_device *dev); void tu_destroy_clear_blit_shaders(struct tu_device *dev); -VkResult _tu_device_set_lost(struct tu_device *device, - const char *msg, ...) PRINTFLIKE(2, 3); -#define tu_device_set_lost(dev, ...) \ - _tu_device_set_lost(dev, __VA_ARGS__) - -static inline bool -tu_device_is_lost(struct tu_device *device) -{ - return unlikely(p_atomic_read(&device->_lost)); -} - VkResult tu_device_submit_deferred_locked(struct tu_device *dev); diff --git a/src/freedreno/vulkan/tu_query.c b/src/freedreno/vulkan/tu_query.c index 27f5860c79e..cff8d610778 100644 --- a/src/freedreno/vulkan/tu_query.c +++ b/src/freedreno/vulkan/tu_query.c @@ -541,7 +541,7 @@ tu_GetQueryPoolResults(VkDevice _device, TU_FROM_HANDLE(tu_query_pool, pool, queryPool); assert(firstQuery + queryCount <= pool->size); - if (tu_device_is_lost(device)) + if (vk_device_is_lost(&device->vk)) return VK_ERROR_DEVICE_LOST; switch (pool->type) { |