LTHI::DrawLayers won't send new metadata if frame has no damage |
|||
Issue descriptionOn http://crrev.com/2842553003 I discovered that not calling ScrollbarAnimationController::DidScrollUpdate from LayerTreeImpl::UpdateScrollbars broke ContentViewScrollingTest#testOverScroll (flaky but usually failing): https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/278902 That's surprising because testOverScroll only cares about scroll offsets, not scrollbar opacity. It turns out that if we don't show the scrollbars, LayerTreeHostImpl::DrawLayers exits early because frame->has_no_damage is true. As a result of this, it fails to submit a frame to the CompositorFrameSink, even though the metadata (specifically CompositorFrameMetadata::root_scroll_offset) would have changed. As a result of that, we fail to call RenderWidgetHostViewAndroid::OnFrameMetadataUpdated, which tells the test about scroll offset changes via ContentViewCoreImpl::UpdateFrameInfo. My patch was missing a codepath which should have shown the scrollbars (VisualViewport::UpdateScrollOffset). Fixing it to show the scrollbars made the test pass again. But it's very brittle for CVCI::UpdateFrameInfo to depend on scrollbar opacity updates. Shouldn't DrawLayers submit the frame if any metadata changed?
,
Apr 25 2017
,
Apr 25 2017
BTW I'm not convinced this is limited to tests. RenderWidgetHostViewAndroid::OnFrameMetadataUpdated is doing a bunch of stuff with overscroll effects and whatnot. I don't know enough about this area to answer #3. I'm also not blocked on this, since adding a call to WebLayer::ShowScrollbars from VisualViewport::UpdateScrollOffset avoids the issue, but I wanted to file this to capture my findings.
,
Apr 25 2017
> 1. The whole point of DrawLayers is to make a CompositorFrame to be drawn on the screen. Doing all that just to send a piece of metadata is very expensive. This cost really doesn't matter if it's a super occasional scenario in reality. However, if we universally push frames on metadata change, there is a risk that some metadata property might flap around and cause frames to unnecessarily be pushed at 60fps. I think that's the only real performance concern here. > 3. Is there some better channel for this data then? No, I really don't want to go back to a world where scroll offset information is sent asynchronously from frames themselves.
,
Apr 25 2017
Maybe we need to be able to SubmitCompositorFrame with metadata only, and cc can decide based on damage then. Cuz computing all the transforms etc to update a scroll offset isn't the best.
,
Apr 25 2017
I guess ContentViewScrollingTest#testOverScroll has this behavior because the test page is mostly blank, and CC is smart enough to avoid damage when scrolling from white to more white? That's a real corner case for sure. It seems this test is indirectly protecting us from scrollbar-disappearing bugs, that might even be useful although the only problem is that the reason might be unclear to developers. I can't think of any action I particularly think is worth doing to improve the situation, so WontFix I guess. |
|||
►
Sign in to add a comment |
|||
Comment 1 by danakj@chromium.org
, Apr 25 2017