Commit 8da24db8 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Fix GPU hang in VulkanSwapChain::Destroy()

Because a mesa bug, the vulkan swapchain can hang with X11, fix the
hang by using a one second timeout with vkWaitForFences() call.

Bug: 1130495
Change-Id: Id9f36a3b087e9d7f6307e708a5cde41d631a9d63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518949Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824398}
parent bd250c81
...@@ -95,8 +95,13 @@ void VulkanSwapChain::Destroy() { ...@@ -95,8 +95,13 @@ void VulkanSwapChain::Destroy() {
// other fences and semaphores safely. // other fences and semaphores safely.
base::ScopedBlockingCall scoped_blocking_call( base::ScopedBlockingCall scoped_blocking_call(
FROM_HERE, base::BlockingType::MAY_BLOCK); FROM_HERE, base::BlockingType::MAY_BLOCK);
vkWaitForFences(device, 1, &fence_and_semaphores_queue_.back().fence, // Use 1 second timeout for vkWaitForFences(), it should be long enough.
VK_TRUE, UINT64_MAX); constexpr auto kTimeout = base::TimeTicks::kNanosecondsPerSecond;
auto result =
vkWaitForFences(device, 1, &fence_and_semaphores_queue_.back().fence,
VK_TRUE, kTimeout);
if (result != VK_SUCCESS)
LOG(ERROR) << "vkWaitForFences() failed: " << result;
} }
for (auto& fence_and_semaphores : fence_and_semaphores_queue_) { for (auto& fence_and_semaphores : fence_and_semaphores_queue_) {
vkDestroyFence(device, fence_and_semaphores.fence, vkDestroyFence(device, fence_and_semaphores.fence,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment