e22f19cf52
This patch implements the majority of the planned picture caching improvements. It supports most of the functionality required to (as a follow up) support OS compositor integration. It also improves on the robustness and functionality of the previous picture caching implementation. There are some expected temporary performance regressions in some cases (such as content that is constantly invalidating) and during initial page render when many render targets must be drawn to. These performance regressions will be resolved in follow up commits by supporting multi-resolution tiles. The scene is split into a number of slices, determined by the scroll root of each primitive, which can be found by the primitive's spatial node indices. If a scene contains too many slices, then picture caching is disabled on the page, to avoid excessive texture memory usage, and rendering falls back to rasterizing each frame. The specific changes in this patch are: * Support tile caches for multiple scroll roots, allowing the entire page (including fixed divs and the main UI bar) to be cached in most cases, in addition to the main content. * Remove requirement to read tiles back from the framebuffer. Instead, they are drawn into the picture cache target tiles, and blitted to the screen. This is slightly slower than the existing picture caching when content is constantly changing, however this cost will disappear / become irrelevant when the OS compositor integration work is complete. * Switch picture cache render targets to be nearest sampled (they are always rendered 1:1) and support depth buffer targets. * Make use of the external scroll offset support to allow removal of the primitive correlation hacks in the previous picture caching implementation. Also allows storing of primitive dependencies in picture space rather than world space, which reduces floating point inaccuracies. * Determine if each tile and picture cache can be considered opaque. This is used to determine whether subpixel AA text rendering is available on a slice, and for rendering optimizations related to disabling blending and/or tile clears. * Use the clip chain instance results from the recent visibility pass work to determine clip chain dependencies. This results in fewer clip item dependencies in tiles, which is faster to check validity and reduces redundant invalidations. * Remove extra overhead during batching related to batch lists, and region iteration, as they are no longer required. * Support PrimitiveVisibilityMask during batching. This allows a single traversal of a picture (surface) root during batching to efficiently construct multiple alpha batcher objects (typically one per invalida tile). * Picture caching is now handled implicitly by WR, depending on the content of the scene. There is no requirement for client code to manually select which stacking context should be cached. * Simplify how clip chain / transform dependencies are tracked by picture cache tiles. * Support pushing / popping enclosing clip chain roots without the need for a stacking context / picture in some cases. This simplifies the logic to split the scene into multiple slices. The main remaining work in this area is (a) extend the code to optionally provide each slice as an input to the OS compositor rather than drawing the tiles in WR, and (b) support multi-resolution tiles so that we reduce the draw call, batching and render target overhead in cases where much of the page content is changing. Differential Revision: https://phabricator.services.mozilla.com/D34319 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
ci-scripts | ||
debugger | ||
direct-composition | ||
examples | ||
webrender | ||
webrender_api | ||
webrender_build | ||
wr_malloc_size_of | ||
wrench | ||
.gitignore | ||
.taskcluster.yml | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE | ||
README.md | ||
appveyor.yml | ||
rustfmt.toml | ||
servo-tidy.toml |
README.md
WebRender
GPU renderer for the Web content, used by Servo.
Note that the canonical home for this code is in gfx/wr folder of the mozilla-central repository at https://hg.mozilla.org/mozilla-central. The Github repository at https://github.com/servo/webrender should be considered a downstream mirror, although it contains additional metadata (such as Github wiki pages) that do not exist in mozilla-central. Pull requests against the Github repository are still being accepted, although once reviewed, they will be landed on mozilla-central first and then mirrored back. If you are familiar with the mozilla-central contribution workflow, filing bugs in Bugzilla and submitting patches there would be preferred.
Update as a Dependency
After updating shaders in WebRender, go to servo and:
- Go to the servo directory and do ./mach update-cargo -p webrender
- Create a pull request to servo
Use WebRender with Servo
To use a local copy of WebRender with servo, go to your servo build directory and:
- Edit Cargo.toml
- Add at the end of the file:
[patch."https://github.com/servo/webrender"]
"webrender" = { path = "<path>/webrender" }
"webrender_api" = { path = "<path>/webrender_api" }
where <path>
is the path to your local copy of WebRender.
- Build as normal
Documentation
The Wiki has a few pages describing the internals and conventions of WebRender.
Testing
Tests run using OSMesa to get consistent rendering across platforms.
Still there may be differences depending on font libraries on your system, for example.
See this gist for how to make the text tests useful in Fedora, for example.