Commit ba357347 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

vulkan: fix gpu hang or crash during destroy vulkan surface.

The hang is because fence helper is used for destroying vulkan
surface asynchronously. However the platform window (X11, android
or Win32 window) could be destroyed before destroying the vulkan
surface which is created for the native window. It causes hang or
crash. Fix the problem by calling vkWaitQueueIdle() and destroying
the vulkan surface synchronously.

Bug: 1062727,1062703
Change-Id: I73715fe0548221dc33cd5ffb2c266d53795dbb13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2138253
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756865}
parent 05ce9496
......@@ -6,12 +6,10 @@
#include <utility>
#include "base/system/sys_info.h"
#include "build/build_config.h"
#include "components/viz/common/gpu/vulkan_context_provider.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/ipc/common/gpu_surface_lookup.h"
#include "gpu/vulkan/vulkan_fence_helper.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
#include "gpu/vulkan/vulkan_implementation.h"
#include "gpu/vulkan/vulkan_surface.h"
......@@ -58,23 +56,8 @@ SkiaOutputDeviceVulkan::~SkiaOutputDeviceVulkan() {
if (!vulkan_surface_)
return;
#if defined(OS_ANDROID)
if (base::SysInfo::IsLowEndDevice()) {
// For low end device, output surface will be destroyed when chrome goes
// into background. And a new output surface will be created when chrome
// goes to foreground again. The vulkan surface cannot be created
// successfully, if the old vulkan surface is not destroyed. To avoid the
// problem, we sync the device queue, and destroy the vulkan surface
// synchronously.
vkQueueWaitIdle(context_provider_->GetDeviceQueue()->GetVulkanQueue());
vulkan_surface_->Destroy();
return;
}
#endif
auto* fence_helper = context_provider_->GetDeviceQueue()->GetFenceHelper();
fence_helper->EnqueueVulkanObjectCleanupForSubmittedWork(
std::move(vulkan_surface_));
}
bool SkiaOutputDeviceVulkan::Reshape(const gfx::Size& size,
......
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