Commit 7ec9d63b authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

aw: Fix gpu memory leak on detach

As mentioned in the bug, when renderer does not produce a frame,
ChildFrame will not update layer_tree_frame_sink_id in
WaitOnFutureIfNeeded, so it's kept at 0u. Then this messes up
HardwareRenderer::last_committed_layer_tree_frame_sink_id_ tracking
which can lead to resources incorrectly not returned in
HardwareRenderer::ReturnResourcesToCompositor.

Not only positive values are valid frame_sink_id, so it is safe to use
0u as a sentinel value. See g_next_layer_tree_frame_sink_id in
render_thread_impl.cc. So avoid updating HardwareRenderer if the id is
invalid.

Bug: 1059869
Change-Id: Ibcec3d474ab09f360d4b16c1ca20e46527603565
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094471Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748344}
parent d9a91dbe
......@@ -66,7 +66,9 @@ void HardwareRenderer::Draw(HardwareRendererDrawParams* params) {
child_frame_ = std::move(child_frame_queue_.front());
child_frame_queue_.clear();
}
if (child_frame_) {
// 0u is not a valid frame_sink_id, but can happen when renderer did not
// produce a frame. Keep the existing id in that case.
if (child_frame_ && child_frame_->layer_tree_frame_sink_id > 0u) {
last_committed_layer_tree_frame_sink_id_ =
child_frame_->layer_tree_frame_sink_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