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

Fix crash in SkiaRenderer::BindFramebufferToOutputSurfac()

Remove the CHECK(root_canvas_) in BindFramebufferToOutputSurfac()
which causes crashes. However we cannot figure out why root_canvas_
is nullptr for those crashes. We just handle nullptr root_canvas_,
and MarkContextLost() if some error happens later on the gpu thread.

Bug: 1092911
Change-Id: I4a0f456aa96b4c5a61e19300effbe6e789a53a47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2261400
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781670}
parent 5aeeccc0
......@@ -837,8 +837,6 @@ void SkiaRenderer::BindFramebufferToOutputSurface() {
switch (draw_mode_) {
case DrawMode::DDL: {
root_canvas_ = skia_output_surface_->BeginPaintCurrentFrame();
// TODO(https://crbug.com/1038107): Handle BeginPaintCurrentFrame() fail.
CHECK(root_canvas_);
break;
}
case DrawMode::SKPRECORD: {
......
......@@ -485,7 +485,6 @@ gpu::SyncToken SkiaOutputSurfaceImpl::SubmitPaint(
sync_token.SetVerifyFlush();
auto ddl = current_paint_->recorder()->detach();
DCHECK(ddl);
// impl_on_gpu_ is released on the GPU thread by a posted task from
// SkiaOutputSurfaceImpl::dtor. So it is safe to use base::Unretained.
......@@ -773,7 +772,7 @@ SkiaOutputSurfaceImpl::CreateSkSurfaceCharacterization(
? GrProtected::kYes
: GrProtected::kNo);
VkFormat vk_format = VK_FORMAT_UNDEFINED;
LOG_IF(FATAL, !characterization.isValid())
LOG_IF(DFATAL, !characterization.isValid())
<< "\n surface_size=" << surface_size.ToString()
<< "\n format=" << static_cast<int>(format)
<< "\n color_type=" << static_cast<int>(color_type)
......
......@@ -891,13 +891,17 @@ bool SkiaOutputSurfaceImplOnGpu::FinishPaintCurrentFrame(
base::Optional<gfx::Rect> draw_rectangle) {
TRACE_EVENT0("viz", "SkiaOutputSurfaceImplOnGpu::FinishPaintCurrentFrame");
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(ddl);
DCHECK(!scoped_output_device_paint_);
bool need_fbo0 = gl_surface_ && !gl_surface_->IsSurfaceless();
if (!MakeCurrent(need_fbo0))
return false;
if (!ddl) {
MarkContextLost(CONTEXT_LOST_UNKNOWN);
return false;
}
if (draw_rectangle)
output_device_->SetDrawRectangle(*draw_rectangle);
......@@ -1081,6 +1085,11 @@ void SkiaOutputSurfaceImplOnGpu::FinishPaintRenderPass(
if (!MakeCurrent(false /* need_fbo0 */))
return;
if (!ddl) {
MarkContextLost(CONTEXT_LOST_UNKNOWN);
return;
}
PullTextureUpdates(std::move(sync_tokens));
auto& offscreen = offscreen_surfaces_[id];
......
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