mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2025-12-29 12:30:12 +01:00
Avoid returning VK_ERROR_DEVICE_LOST
VK_ERROR_DEVICE_LOST implies that the GPU device has entered an unrecoverable state and further API usage is considered invalid. Thus, it should be used sparingly. For the layer code, we were returning VK_ERROR_DEVICE_LOST for implementation specific errors as sort of a catch all, even when the GPU was still usable. Instead, it would be better to return other error codes to denote a failure somewhere. For the page_flip_thread, if we receive a VK_TIMEOUT waiting for the image's present fence, then we continously retry. All other error codes will still be propagated. For the wayland swapchain, instead of returning VK_ERROR_DEVICE_LOST when we encounter an error in the dispatch_queue call, return VK_ERROR_SURFACE_LOST_KHR, as this is more suitable. Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com> Change-Id: Iccc3e75b60fe9296b10963e7f0b3041fbcd29198
This commit is contained in:
parent
43d806de38
commit
07c1a4aa21
2 changed files with 6 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2022 Arm Limited.
|
||||
* Copyright (c) 2017-2023 Arm Limited.
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
|
@ -78,18 +78,12 @@ void swapchain_base::page_flip_thread()
|
|||
image_status_lock.unlock();
|
||||
|
||||
/* We may need to wait for the payload of the present sync of the oldest pending image to be finished. */
|
||||
vk_res = image_wait_present(sc_images[*pending_index], timeout);
|
||||
while ((vk_res = image_wait_present(sc_images[*pending_index], timeout)) == VK_TIMEOUT)
|
||||
{
|
||||
WSI_LOG_WARNING("Timeout waiting for image's present fences, retrying..");
|
||||
}
|
||||
if (vk_res != VK_SUCCESS)
|
||||
{
|
||||
/*
|
||||
* Setting the error state to VK_TIMEOUT would communicate the wrong error
|
||||
* state to the application through acquire_next_image. For this reason we
|
||||
* convert it to VK_ERROR_DEVICE_LOST.
|
||||
*/
|
||||
if (vk_res == VK_TIMEOUT)
|
||||
{
|
||||
vk_res = VK_ERROR_DEVICE_LOST;
|
||||
}
|
||||
set_error_state(vk_res);
|
||||
m_free_image_semaphore.post();
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ VkResult swapchain::get_free_buffer(uint64_t *timeout)
|
|||
}
|
||||
else
|
||||
{
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
return VK_ERROR_SURFACE_LOST_KHR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue