Hi there! Time for another mozilla graphics newsletter. In the comments section of the previous newsletter, Michael asked about the relation between WebRender and WebGL, I’ll try give a short answer here.
Both WebRender and WebGL need access to the GPU to do their work. At the moment both of them use the OpenGL API, either directly or through ANGLE which emulates OpenGL on top of D3D11. They, however, each work with their own OpenGL context. Frames produced with WebGL are sent to WebRender as texture handles. WebRender, at the API level, has a single entry point for images, video frames, canvases, in short for every grid of pixels in some flavor of RGB format, be them CPU-side buffers or already in GPU memory as is normally the case for WebGL. In order to share textures between separate OpenGL contexts we rely on platform-specific APIs such as EGLImage and DXGI.
Beyond that there isn’t any fancy interaction between WebGL and WebRender. The latter sees the former as a image producer just like 2D canvases, video decoders and plain static images.
What’s new in gfx
Wayland and hidpi improvements on Linux
- Martin Stransky made a proof of concept implementation of DMABuf textures in Gecko’s IPC mechanism. This dmabuf EGL texture backend on Wayland is similar what we have on Android/Mac. Dmabuf buffers can be shared with main/compositor process, can be bound as a render target or texture and can be located at GPU memory. The same dma buf buffer can be also used as hardware overlay when it’s attached to wl_surface/wl_subsurface as wl_buffer.
- Jan Horak fixed a bug that prevented tabs from rendering after restoring a minimized window.
- Jan Horak fixed the window parenting hierarchy with Wayland.
- Jan Horak fixed a bug with hidpi that was causing select popups to render incorrectly after scrolling.
WebGL multiview rendering
WebGL’s multiview rendering extension has been approved by the working group and it’s implementation by Jeff Gilbert will be shipping in Firefox 70.
This extension allows more efficient rendering into multiple viewports, which is most commonly use by VR/AR for rendering both eyes at the same time.
Better high dynamic range support
Jean Yves landed the first part of his HDR work (a set of 14 patches). While we can’t yet output HDR content to HDR screen, this work greatly improved the correctness of the conversion from various HDR formats to low dynamic range sRGB.
You can follow progress on the color space meta bug.
What’s new in WebRender
If you are curious about the state of WebRender on a particular platform, up to date information is available at http://arewewebrenderyet.com
Speaking of which, darkspirit enabled webrender on Nightly for Nvidia+Nouveau drivers linux users in Firefox Nightly.
More filters in WebRender
When We run into a primitive that isn’t supported by WebRender, we make it go through software fallback implementation which can be slow for some things. SVG filters are a good example of primitives that perform much better if implemented on the GPU in WebRender.
Connor Brewster has been working on implementing a number of SVG filters in WebRender:
- Bug 1555483 – Introduce some infrastructure for SVG filters in WebRender and implement the feBlend filter.
- Bug 1178765 – Implement backdrop-filter from the Filter Effects Module Level 2 specification.
See the SVG filters in WebRender meta bug.
Texture swizzling and allocation
WebRender previously only worked with BGRA for color textures. Unfortunately this format is optimal on some platforms but sub-optimal (or even unsupported) on others. So a conversion sometimes has to happen and this conversion if done by the driver can be very costly.
Kvark reworked the texture caching logic to support using and swizzling between different formats (for example RGBA and BGRA).
A document that landed with the implementation provides more details about the approach and context.
Kvark also improved the texture cache allocation behavior.
Jamie fixed emoji rendering on webrender on android and continues investigating driver issues on Adreno 3xx devices.
Dan replaced bincode in our DL IPC code with a new bespoke and private serialization library (peek-poke), ending the terrible reign of the secret serde deserialize_in_place hacks and our fork of serde_derive.
Picture caching improvements
Glenn landed several improvements and fixes to the picture caching infrastructure:
- Bug 1566712 – Fix quality issueswith picture caching when transform has fractional offsets.
- Bug 1572197 – Fix world clip region for preserve-3d items with picture caching.
- Bug 1566901 – Make picture caching more robust to float issues.
- Bug 1567472 – Fix bug in preserve-3d batching code in WebRender.
Font rendering improvements
Lee landed quite a few font related patches:
- Bug 1569950 – Only partially clear WR glyph caches if it is not necessary to fully clear.
- Bug 1569174 – Disable embedded bitmaps if ClearType rendering mode is forced.
- Bug 1568841 – Force GDI parameters for GDI render mode.
- Bug 1568858 – Always stretch box shadows except for Cairo.
- Bug 1568841 – Don’t use enhanced contrast on GDI fonts.
- Bug 1553818 – Use GDI ClearType contrast for GDI font gamma.
- Bug 1565158 – Allow forcing DWrite symmetric rendering mode.
- Bug 1563133 – Limit the GlyphBuffer capacity.
- Bug 1560520 – Limit the size of WebRender’s glyph cache.
- Bug 1566449 – Don’t reverse glyphs in GlyphBuffer for RTL.
- Bug 1566528 – Clamp the amount of synthetic bold extra strikes.
- Bug 1553228 – Don’t free the result of FcPatternGetString.
Various fixes and improvements
- Gankra fixed an issue with addon popups and document splitting.
- Sotaro prevented some unnecessary composites on out-of-viewport external image updates.
- Nical fixed an integer oveflow causing the browser to freeze
- Nical improved the overlay profiler by showing more relevant numbers when the timings are noisy.
- Nical fixed corrupted rendering of progressively loaded images.
- Nical added a fast path when none of the primitives of an image batch need anti-aliasing or repetition.