Closed Bug 1377688 Opened 7 years ago Closed 7 years ago

NewScrollFrameReady causes us to double-composite, halving the effective frame rate

Categories

(Core :: Graphics: WebRender, defect)

All
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: mstange, Assigned: sotaro)

References

Details

Attachments

(1 file, 1 obsolete file)

Steps to reproduce: 0. Enable webrender and restart. 1. Optionally enable the webrender profiler overlay, so that you can see the FPS that webrender thinks it's getting. 2. Do something that we should have no problems getting 60fps at. For example: 2a. Run a CSS animation (e.g. attachment 8882831 [details]), or 2b. Scroll slowly, or 2c. Drag to select text within a single line of text. Expected results: The displayed screen updates should be smooth at 60fps. Actual results: Animations are jerky, the screen only updates at 30fps. At the same time, the webrender overlay displays around 60fps. Here's a profile of the Renderer thread: https://perfht.ml/2twi2AH It shows that we're constantly compositing, and that the SwapBuffers calls take, on average, 16.6ms. However, it also shows that SwapBuffers is called from two different call stacks: From NewFrameReady and NewScrollFrameReady. (The NewScrollFrameReady method isn't visible in the profile, I think because it's getting inlined into the runnable lambda.) It looks like we're trying to present every single frame twice. If I remove the call to "UpdateAndRender(aWindowId);" in RenderThread::NewScrollFrameReady, everything becomes smooth again.
Assignee: nobody → sotaro.ikeda.g
We do not need to do call UpdateAndRender() in RenderThread::NewScrollFrameReady(). The NewScrollFrameReady() is triggered like the following. WebRenderBridgeParent::CompositeToTarget() is implemented to call WebRenderAPI::GenerateFrame() if it is necessary to trigger UpdateAndRender(). It should be enough. WebRenderBridgeParent::CompositeToTarget() ->WebRenderBridgeParent::PushAPZStateToWR() ->APZCTreeManager::PushStateToWR() ->WebRenderAPI::UpdateScrollPosition() ->wr_scroll_layer_with_id() ->RenderApi::scroll_node_with_id() ->//send ApiMsg::ScrollNodeWithId message ->//receive ApiMsg::ScrollNodeWithId message ->RenderBackend::notify_compositor_of_new_scroll_frame() ->new_scroll_frame_ready() ->wr_notifier_new_scroll_frame_ready() ->RenderThread::NewScrollFrameReady() ->RenderThread::UpdateAndRender()
Attachment #8884169 - Flags: review?(bugmail)
Comment on attachment 8884169 [details] [diff] [review] patch - Remove RenderThread::NewScrollFrameReady() Review of attachment 8884169 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/webrender_bindings/RenderThread.cpp @@ -404,5 @@ > > void wr_notifier_new_scroll_frame_ready(WrWindowId aWindowId, bool aCompositeNeeded) > { > - mozilla::wr::RenderThread::Get()->NewScrollFrameReady(mozilla::wr::WindowId(aWindowId), > - aCompositeNeeded); Please add a comment here explaining why it is not needed (or put the bug number for people to look up)
Attachment #8884169 - Flags: review?(bugmail) → review+
Apply the comment.
Attachment #8884169 - Attachment is obsolete: true
Attachment #8884687 - Flags: review+
Pushed by sikeda@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/3735f14246b9 Remove RenderThread::NewScrollFrameReady() r=kats
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: