servo/components/compositing
Patrick Walton 9b4cc41695 compositing: Stop compositing unnecessarily after each animation frame.
Instead, schedule a delayed composite after each frame of an animation.

The previous code would cause jank, because the following sequence
frequently occurred:

1. The page uses `requestAnimationFrame()` to request a frame.

2. The compositor receives the message, schedules a composite,
dispatches the rAF message to the script thread, composites, and goes to
sleep waiting for vblank (frame 1).

3. The script makes a change and sends it through the pipeline.
Eventually it gets painted and is sent to the compositor, but the
compositor is sleeping.

4. The compositor wakes up, sees the new painted content, page flips,
and goes to sleep (frame 2). Repeat from step 1.

The problem is that we have two composition frames, not just one. This
halves Web apps' framerate!

This commit fixes the problem by scheduling the composite in step 2 to
12 ms in the future. We already have this delayed-composition
functionality in the form of the scrolling timer, which I repurposed and
renamed to the "delayed composition timer" for this task. This change
gives the page 12 ms to prepare the frame, which seems to usually be
enough, especially with WebRender.

Note that simply removing the scheduled composite after rAF is not the
correct solution. If this is done, then pages that call rAF and don't
modify the page won't receive future rAFs, since the compositor will be
sleeping and won't be notified of vblank.

Fixes a bunch of jank in browser.html. The remaining jank seems to be a
problem with browser.html itself.
2016-02-24 14:06:46 -08:00
..
Cargo.toml Update webrender crate refs to reflect ownership change. 2016-02-23 19:49:50 -05:00
compositor.rs compositing: Stop compositing unnecessarily after each animation frame. 2016-02-24 14:06:46 -08:00
compositor_layer.rs compositing: Fix a couple of bugs that prevented iframes from painting 2016-01-26 16:37:23 -05:00
compositor_thread.rs compositing: Stop compositing unnecessarily after each animation frame. 2016-02-24 14:06:46 -08:00
constellation.rs Add WebRender integration to Servo. 2016-02-18 10:35:29 +10:00
delayed_composition.rs compositing: Stop compositing unnecessarily after each animation frame. 2016-02-24 14:06:46 -08:00
headless.rs compositing: Stop compositing unnecessarily after each animation frame. 2016-02-24 14:06:46 -08:00
lib.rs compositing: Stop compositing unnecessarily after each animation frame. 2016-02-24 14:06:46 -08:00
pipeline.rs Add WebRender integration to Servo. 2016-02-18 10:35:29 +10:00
sandboxing.rs Remove unused import. 2015-11-20 08:55:41 +01:00
scrolling.md Add documentation about the scrolling model 2014-10-10 09:26:43 -07:00
surface_map.rs task -> thread 2016-01-10 17:58:13 +09:00
timer_scheduler.rs task -> thread 2016-01-10 17:58:13 +09:00
touch.rs Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00
windowing.rs Move util::cursor to style_traits 2016-02-16 00:50:01 +01:00