Many people have asked me what I'm working on lately, and I thought I'd give a quick rundown of my status and plans for 2019. I intend to keep this post updated with the status of projects as they progress.
In no particular order:
Integrating font-kit
and Pathfinder into WebRender for fonts
I plan to deploy Pathfinder as an optional runtime backend for GPU font rendering in WebRender.
Broadly speaking, the WebRender plan is to perform a staged rollout to let us catch bugs
(especially driver bugs) as we find them, so Pathfinder won't be turned on by default right away.
But it should be accessible soon in Servo behind a flag, as well as in Firefox behind an
about:config
setting. Deploying this requires replacing the WebRender font infrastructure with
the font-kit
crate, which allows the CPU and GPU font rendering paths to share the same font
loading infrastructure. (CPU font rendering will always need to stick around at least in some form,
because of special glyph formats like PNG emoji that don't make sense to render on GPU.)
Status: WebRender has an older version of the Pathfinder stencil shader in-tree and a
compile-time switch to enable the code. It's currently pinned to an older version of Pathfinder
that predates the font-kit
transition.
Introducing Pathfinder-backed SVG support to WebRender
Today, WebRender uses Skia's CPU rasterizer to render SVG, but in the near future WebRender should support GPU SVG rendering using Pathfinder. Concretely, this means adding Fill and Stroke display items to WebRender and using Pathfinder's infrastructure to rasterize them. (Fills and strokes aren't everything, of course—in order to fully support SVG, there will need to be some additional functionality added, such as support for the SVG filters that aren't in CSS.)
Status: I'm prototyping a simple approach to SVG rendering based on adaptive tiling. Should it pan out, this technique should allow us to rasterize SVG using essentially the same shader code as font rendering, reducing complexity.
Adding support for native OS compositors to WebRender
It's become apparent that WebRender would benefit from using the native OS compositor:
DirectComposition on Windows, Core Animation on macOS, and potentially Wayland on Linux. The main
reason is for energy savings: at present, both Servo and Gecko (with and without WebRender) don't
fully use the OS compositor for scrolling and constantly incur full window blits on every frame.
In effect, even though our use of the GPU is fairly optimal, the OS compositor constantly blits
the contents of the window behind our back. All that extra blitting causes excessive power
consumption. Unfortunately, there's no clean cross-platform solution for this: it involves writing
a lot of platform-specific code. To that end, I've started work on a crate called planeshift
that offers a cross-platform abstraction over a minimal set of OS compositor functionality, enough
to implement scrolling. This should ultimately make Servo and Gecko significantly more energy
efficient, especially on macOS.
Status: The planeshift
crate is essentially feature-complete but needs documentation and unit
testing. After that, it needs WebRender integration, as well as an unknown amount of integration
with the "widget" layer of Gecko. I'm waiting for picture caching to mature before working heavily
on that, since we need picture caching on the WebRender side to get good use out of the OS
compositor.
Servo layout 2.0
Finally, I'm leading a small team to rewrite Servo layout, with an eye toward correctness, production quality, and performance. Servo layout is an excellent proof of concept that parallel layout is possible, but its age (far predating Rust 1.0) and other design decisions make it very hard to grow into a production layout engine. I'm confident at this point that parallel layout is possible; now it's time to make it a reality.
Along the way, I hope to produce a high-quality international text layout library (think something like Pango) for the Rust community to use. Text is one of the biggest missing pieces in the Rust UI ecosystem, and I'd love for our Servo work to help fill in the gap. Manish is interested in heading up this text work, while Simon will likely be hacking on CSS block layout. Please get in touch if you'd like to help contribute!
Status: I have a Servo branch for this work that is at a very early stage. There will likely be some rapid experimentation over the first few months of 2019 to find exactly the right abstractions and to get the foundation right for the long-term.