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

Fix a DCHECK() crash related to render pass overlay backing reusing on macOS

We assume ScheduleOverlays() will be called for every frame, so we
can release not reused overlay backing for ever frame. However
ScheduleOverlays() are not called for some cases. So the DCHECK() crash
happends, fix the problem by releasing not used render pass overlay
backings in SwapBuffers().

Bug: 1135399
Change-Id: I634a254e98d086f7799d76af5d5a82ad2010f854
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2507450
Commit-Queue: Peng Huang <penghuang@chromium.org>
Auto-Submit: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822207}
parent 0b0abfe7
...@@ -1015,11 +1015,6 @@ void SkiaOutputSurfaceImplOnGpu::ScheduleOverlays( ...@@ -1015,11 +1015,6 @@ void SkiaOutputSurfaceImplOnGpu::ScheduleOverlays(
} }
promise_image_access_helper_.EndAccess(); promise_image_access_helper_.EndAccess();
output_device_->ScheduleOverlays(std::move(overlays)); output_device_->ScheduleOverlays(std::move(overlays));
// Release any backings which are not reused by the current frame, probably
// because the properties of render passes are changed or render passes are
// removed.
available_render_pass_overlay_backings_.clear();
#else #else
DCHECK(image_contexts.empty()); DCHECK(image_contexts.empty());
output_device_->ScheduleOverlays(std::move(overlays)); output_device_->ScheduleOverlays(std::move(overlays));
...@@ -1356,9 +1351,16 @@ void SkiaOutputSurfaceImplOnGpu::SwapBuffersInternal( ...@@ -1356,9 +1351,16 @@ void SkiaOutputSurfaceImplOnGpu::SwapBuffersInternal(
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(output_device_); DCHECK(output_device_);
#if defined(OS_APPLE)
// Release any backings which are not reused by the current frame, probably
// because the properties of render passes are changed or render passes are
// removed.
available_render_pass_overlay_backings_.clear();
#endif
if (context_is_lost_) if (context_is_lost_)
return; return;
ResetStateOfImages(); ResetStateOfImages();
output_device_->PreGrContextSubmit(); output_device_->PreGrContextSubmit();
gr_context()->submit(); gr_context()->submit();
...@@ -1460,7 +1462,7 @@ void SkiaOutputSurfaceImplOnGpu::DidSwapBuffersCompleteInternal( ...@@ -1460,7 +1462,7 @@ void SkiaOutputSurfaceImplOnGpu::DidSwapBuffersCompleteInternal(
#if defined(OS_APPLE) #if defined(OS_APPLE)
// |available_render_pass_overlay_backings_| are used or released in // |available_render_pass_overlay_backings_| are used or released in
// ScheduleOverlays() for every frames. // SwapBuffers() for every frames.
DCHECK(available_render_pass_overlay_backings_.empty()); DCHECK(available_render_pass_overlay_backings_.empty());
// Erase mailboxes of render pass overlays from |params.released_overlays| and // Erase mailboxes of render pass overlays from |params.released_overlays| and
......
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