Commit 14ef10ec authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Vulkan: fix Crash drawing root render pass

The crash is because the vulkan device lost. Fix the problem by
always calling context_state_->MakeCurrent() in
SkiaOutputSurfaceImplOnGpu::MakeCurrent(), it will check vulkan
device lost by testing gr_context_->abandoned(), and if the device
is lost, we will skip the draw to avoid crash.

Bug: 1068161
Change-Id: I128df218958c0fb0d8f48e8533678f90ceab270b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2146235
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758405}
parent 2d0aad1e
...@@ -1619,13 +1619,12 @@ bool SkiaOutputSurfaceImplOnGpu::InitializeForDawn() { ...@@ -1619,13 +1619,12 @@ bool SkiaOutputSurfaceImplOnGpu::InitializeForDawn() {
} }
bool SkiaOutputSurfaceImplOnGpu::MakeCurrent(bool need_fbo0) { bool SkiaOutputSurfaceImplOnGpu::MakeCurrent(bool need_fbo0) {
if (context_state_->context_lost()) // need_fbo0 implies need_gl too.
return false; bool need_gl = need_fbo0;
if (gpu_preferences_.gr_context_type == gpu::GrContextType::kGL) {
// Only make current with |gl_surface_|, if following operations will use // Only make current with |gl_surface_|, if following operations will use
// fbo0. // fbo0.
if (!context_state_->MakeCurrent(need_fbo0 ? gl_surface_.get() : nullptr)) { auto* gl_surface = need_fbo0 ? gl_surface_.get() : nullptr;
if (!context_state_->MakeCurrent(gl_surface, need_gl)) {
LOG(ERROR) << "Failed to make current."; LOG(ERROR) << "Failed to make current.";
dependency_->DidLoseContext( dependency_->DidLoseContext(
gpu::error::kMakeCurrentFailed, gpu::error::kMakeCurrentFailed,
...@@ -1634,7 +1633,6 @@ bool SkiaOutputSurfaceImplOnGpu::MakeCurrent(bool need_fbo0) { ...@@ -1634,7 +1633,6 @@ bool SkiaOutputSurfaceImplOnGpu::MakeCurrent(bool need_fbo0) {
return false; return false;
} }
context_state_->set_need_context_state_reset(true); context_state_->set_need_context_state_reset(true);
}
return true; return true;
} }
......
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