moz://gfx newsletter #48

Greetings! This issue of the newsletter is long overdue. Without further ado:

What’s new in gfx

Wayland dmabuf textures

Martin Stransky landed the dmabuf texture work which was at the prototype stage at the time of the previous newsletter. This is only used with the GL compositor at the moment which is not enabled by default (gfx.acceleration.force-enabled pref in about:config). Work to get dmabuf textures with WebRender is in progress.

CoreAnimation integration

Markus landed a number of infrastructure changes towards integrating with CoreAnimation and doing partial present optimizations on MacOS.
This short description doesn’t do justice to the amount of work that went into this. Stay tuned, you might read some more about this on this blog soon.

Direct Composition integration

Sotaro has been working on a number of bugs in support for Direct Composition integration, including some ground work and investigation such as bugs 1585893, 1585619 and 1585278, and bug fixes like an issue involving the tab bar, direct composition, the high contrast theme and WebRender.

RGB, RGBA, BGRA, BLARGH!

Andrew landed a number of image decoding performance improvements, using SIMD to speed up pixel format conversion.
Benchmarks targeting the improvements suggested a ceiling of 25-50% faster for pixel format conversions, initial telemetry data suggesting 5-10% real world average decoder performance improvement. Not bad!

What’s new in WebRender

WebRender is a GPU based 2D rendering engine for web written in Rust, currently powering Firefox‘s rendering engine as well as the research web browser servo.

To enable WebRender in Firefox, in the about:config, enable the pref gfx.webrender.all and restart the browser.

WebRender is available as a standalone crate on crates.io (documentation) for use in your own rust projects.

WebRender enabled in Firefox Preview Nightly on the Pixel 2

This is the first configuration on Android that Jamie enabled WebRender on by default. A pretty cool milestone to build upon!
Download it here: https://play.google.com/store/apps/details?id=org.mozilla.fenix.nightly
WebRender is only enabled by default for pixel 2 phones at the moment but on other configurations it can be enabled in about:config.

Pixel snapping

Andrew rewrote pixel snapping in WebRender. See the bug description and the six patches series that followed to get an idea of how much work went into this.

Blob image recoordination

If you have been following this newsletter you might remember reading hearing about “blob image recoordination” for a while now. That’s because work has been ongoing for quite a while. A lot of these patches that have been in the work for months landed recently. Blobs are now “recoordinated”.

In other words, Jeff and Nical landed a lot of infrastructure work went into handling the coordinate system of blob images, webrender’s fallback software rendering path.

This puts the fallback code on a saner foundation and allows reducing the invalidation of blob images in various scenarios such as scrolling large SVG elements, or when animations cause the bounds of a blob image to change. This translates to performance improvements on web pages that use SVG a lot.

Picture caching

Glenn landed some pretty big changes to picture caching:

  • The cache is now organized as a quad-tree.
  • Picture cached tiles that are only solid color use a fast path to optimize speed and memory consumption.
  • There is a new composite pass with a simpler drawing model than other render passes. It is a first step towards deferring the composition of cached tiles to OS compositor APIs such as Direct Composition and Core animation, and will allow optimizations for the upcoming software backend.
  • There are now separate picture cache slices for web content, the browser UI and scroll bars.
  • WebRender now generates dirty rects to allow partial present optimizations.

YUV image rendering performance

Kvark fixed YUV images being accidentally rendered in the alpha pass instead of the opaque pass. A very simple change yielding pretty significant performance improvements as it reduces the overdraw while rendering video frames.

Text rendering improvements

Lee removed Cairo usage from the Skia FreeType font host. SkFontHost_cairo depended on the interposition of Cairo for dealing with creating/loading FreeType faces. This imposed annoying limits on our Skia text rasterization such as a lack of sub-pixel text positioning on Android and Linux. It also forced us to build and maintain FcPattern structures that caused memory bloat and had performance overhead to interpret.
With this fixed, Lee enabled sub-pixel positioning on Linux and Android.

Various fixes and improvements

  • Botond fixed a regression affecting WebExtensions that move a tab into a popup or panel window (1), (2).
  • Botond fixed an issue that prevented Windows users with certain Acer and Asus laptops from being able to two-finger scroll on Gmail and various other websites.
  • Botond fixed one of the prerequisites for enabling a hiding URL bar in Firefox Preview.
  • Kvark improved WebRender’s performance when allocating a page requires a lot of cached texture memory.
  • Kvark added support for the Solus linux distribution in Gecko’s build system.
  • Kvark updated the WebGPU IDL
  • Kvark fixed a few IDL bindgen issues in the process (1), (2).
  • Andrew prevented border raster images from going through a slow fallback path.
  • AWilcox fixed YUV image rendering on big-endian machines.
  • Nical cleaned up a lot of the scene building and render graph code in WebRender.
  • Kris fixed an opacity rendering issue on SVG USE elements with D2D.
  • Jonathan Kew fixed a rendering issue with stroked text with ligatures.

23 thoughts on “moz://gfx newsletter #48

    1. WebGPU is a work in progress upcoming web standard, which you can think of as successor of WebGL 2. I don’t know the plans in details since I am not directly involved, but I believe Kvark and Jeff Gilbert aim to ship a nightly-only “preview” version of at least a subset of the API before the end of the year.

  1. Thanks for the blog post @Nical!

    I’d like to have one question (I’ve been asking this before, but I think there was no clear answer to it yet): do I get things right that Wayland DMABUF support + Webrender (once enabled by default and working together etc.) make it possible to finally implement hardware accelerated decoding+rendering of videos on Linux? AFAIK ffmpeg allows e.g. VAAPI output to a DMABUF, which then should be usable by Webrender, similar to the current WebGL work.

    1. Hi Robert, it is my understanding that Martin’s main motivation for the dmabuf work is indeed video playback performance. I don’t know about the details so I won’t say more lest I risk saying something wrong.

  2. What happened to the split rendering of the chrome and the web content? This project seems to be on hold for a long time now?

    1. Document splitting is indeed on hold at the moment. It is very difficult to overcome the long of bugs that happen with it enabled as it changes a number of things with effects spread in many parts of Gecko and WebRender, and we are focusing on lower hanging fruits at the moment.
      Glenn’s recent picture caching change assigning separate caching slices to the UI and the content helps with the GPU side part of what document splitting improves, as a tab animation now does not cause web content to be rendered again, but there is still CPU-side work that would be optimized away by document splitting so we will reevaluate it when we have some time to push it over the line.

      1. Thank you for your answer, that’s very insightful. I think performance wise WebRender really is a major step forward, however the additional CPU overhead is still a bit worrying.

  3. Hello Nical, many thanks for your continuing with these newsletters. It’s very exiting to read what hapens under the hood of Webrender. Keep writing of it further.

  4. Thanks for the update nical. Any news on which version of ff will webrender will be enabed for laptop users? (esp. geforce 1050 series)

    1. See https://wiki.mozilla.org/Platform/GFX/WebRender_Where

      We have it on in Nightly for some laptop configurations, but that doesn’t necessarily mean it rides the train and makes it to the stable channel of the same Firefox version, though. WebRender sticks to Nightly until we’ve had enough usage data for each platform and fixed enough bugs that we are confident it doesn’t cause notable regressions like performance, power usage or correctness issues (such as running into driver-specific bugs).

  5. Hi Nical, thank you for the newsletter I too like reading the newsletter. If you have the time please keep writting the newsletter. Thank you

  6. Hi Nical
    I’m not mad just saying… on my Windows 10 1903 laptop I use Firefox Nightly and asan build 71 64bit.
    I have google play store on both my andriods… Firefox preview Nightly, and Firefox preview. I have webrender enabled on both my andriods my andriod tablet is… Kindle Firehd8 os lollipop and my phone is lg phonex plus Oreo and on Firefox preview only… with webrender enabled the tab button does not work like it use to. Also Firefox preview only in a webpage when you click on the 3dots none of the menu buttons works. These issue use to work on both of my andriods. nightly was fixed and works.
    Only on my andriod phone I have broken text on both… Firefox preview nightly and Firefox preview with webrender enabled…. text shows up broken up on on all webpages. And with webrender enabled it did not use to be like that. But on my tablet with webrender enabled I have no issue with text

    1. I found out today that text problem on my lg Phoenix plus andriod phone os Oreo is because of the…. GPU adreno 308. And I have no problem with text on my…. andriod tablet which is… Kindle Firehd8 os lollipop with GPU mail t720.

  7. I still like these newsletters.
    On my lg Phoenix plus andriod phone os Oreo is because of the…. GPU adreno 308. And I have no problem with text on my…. andriod tablet which is… Kindle Firehd8 os lollipop with GPU mail t720
    The still opened bug was opened long beforethe bug effected me. I still have the bug. So no Im not the one who filed this bug.
    Intermittently missing glyphs on Android on Adreno 3xx devices
    https://bugzilla.mozilla.org/show_bug.cgi?id=1513185

  8. Before 11/3/2019 I use to be able to have webrender enabled and have Firefox preview nightly open. But since 11/3/2019 I can not open Firefox preview nightly unless webrender is disabled. I found this out when I did a cleared cash and cleared data on my andriod phoenix plus os oreo andriod phone. My Kindle Fire hd8 andriod tablet os 5.1.1 is still crashing and Firefox preview nightly on my tablet use before 11/3/2019 opened with webrender enabled. And on my tablet… I did not want to clear cash and data. So I cant disable webrender for Firefox preview nightly… and so Firefox preview nightly wont open and keeps crashing. And yes I do have the Google play store sideload on my tablet.

    1. Continued from my post I wrote and now continued in this reply,
      Since I want to test Webrender…
      My andriod tablet has more space on it then my phone. And I have the Firefox reference browser only on my tablet. I have the Firefox reference browser long before Firefox preview nightly was on the play store. And I have webrender enabled Firefox reference browse on Firefox reference browser and no prombles Firefox reference browser opens and works.
      And Firefox preview is on both my phone and tablet and with webrender enabled it does open on both. But only on the phone I still has the issue with the texed. is..,gpu adreno308 and tablet is…mail t720.
      I only tried to clear cache app data on my lg phoenix plus os oreo andriod phone yesterday. And it did get my andriod phone to open but… I cant have Webrender enabled like I did before 11/3/2019 because if I do it Firefox preview nightly wont open. It use to open with webrender enabled.
      And on my Firefox preview nightly that is on my Kindle firehd8 andriod tablet os lollpop… I did not clear cache app data. And on my tablet I have webrender enabled but.. having webrender enabled on my table my Firefox preview Nightly only opened before 11/3/2019.
      And I do have the google play store sideloade on my tablet.
      And in just in case fyi…
      On Fenix Nightly Google groups
      I posted…, Firefox preview nightly wont open andriods.
      https://groups.google.com/forum/m/?utm_medium=email&utm_source=footer#!topic/fenix-nightly/qAaXsu07lDg

  9. Translated by Google Translator
    Hello.

    I am not a programmer.

    I am trying to get the answer to my question on various internet forums but to no avail. Maybe someone will advise me here.

    I use responsive mode to take screenshots of the entire site at the highest possible resolution of 9999 x 9999. I work with maps in very high resolutions.

    Problem: if the map is in grayscale I can take a screenshot of the page in the highest resolution without any problem but if I switch the same map to the normal RGB mode I can only use the resolution 9999 x 3358 – about 1/3 of the maximum resolution, if I increase this resolution, mozilla stops responding but there is no error information.

    Equipment: 24Gb ram, Nvidia Geforce GT635M – 1Gb ram, Intel Core I7 3610QM

    In my opinion the problem is not the resolution because as I wrote at the beginning if the image is in grayscale – they weigh less because it is not colored – I can easily take a 9999 x 9999 screenshot. My graphics card has 1 Gb of RAM and works very intensively but it doesn’t seem to be a problem, because when the image is fully loaded in responsive mode, I can move it smoothly, etc. etc. So in my opinion the problem lies in some setting in about:config that limits amount of data.

    Are there any settings in about:config that can be changed to solve this problem or some other solution?

    As I wrote at the beginning – I am not a programmer – so if someone could check the link to the map: https://bakar.atlas14.com/ and if they could suggest a solution, please use a language understood by the average Firefox user. However, if this is not the right place to post this problem, please let me know the correct source.

    Greetings.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s