Hacker News new | past | comments | ask | show | jobs | submit login
WebRender2 Lands in Servo (github.com/servo)
158 points by leeoniya on Aug 3, 2016 | hide | past | favorite | 27 comments



There's not much context here, so let me help. WebRender is Servo's renderer, which is the component that takes all the junk that happens behind the scenes (the DOM, etc.) and turns it into something that your monitor can actually display.

What differentiates WebRender from the renderers of all other modern browsers is that renderers have traditionally operated in "immediate mode", where the renderer itself draws items on the screen one at a time, whereas WebRender operates in "retained mode", where the renderer declaratively shunts all the heavy work to the GPU. (And note that I'm hardly a graphics programmer at all, so I may have butchered this.)

Some relevant links:

pcwalton's great demonstration of the initial WebRender prototype from February (page demos start at 26 minutes): https://air.mozilla.org/bay-area-rust-meetup-february-2016/

WebRender 2 overview: https://github.com/servo/servo/wiki/Webrender-Overview#webre...

A short walkthrough of WebRender 2: http://www.masonchang.com/blog/2016/7/18/a-short-walkthrough...

I believe a long-term goal is to get WebRender into Firefox itself, but this would be quite an invasive surgery (and AFAIK wouldn't be able to 100% obviate Gecko's current renderer, for legacy reasons(?)) and so shouldn't be expected in the near future (though Stylo, another large Servo component, should hopefully be landing in Firefox this year).

EDIT: Oh, and of course, Servo is a new browser engine from Mozilla and written in Rust (though it wouldn't be entirely inaccurate to also say that Rust was written for Servo, at least originally :P ).


> and AFAIK wouldn't be able to 100% obviate Gecko's current renderer, for legacy reasons(?))

IIRC it's not just supporting legacy systems, but also things like printing (and print to PDF) need a different renderer. I'm not sure; I forgot the details.

> hat Rust was written for Servo, at least originally

Rust was initially called "The Servo Project", actually


Graydon Hoare started what became Rust some time before 2009. Graydon came up with the name, inspired by the wheat mold, I believe. Rob Sayre and I got Rust sponsored as Graydon's day job by Mozilla in 2009, if memory serves.

I did a brief keynote at Mozilla's Whistler, BC all hands in 2010 proposing Servo, a new layout engine programmed in Rust. Servo was named by Dave Herman and me in honor of Tom Servo from MST3K. Rust was never "The Servo Project".


Huh, I thought that both Servo and Rust were internally under the Servo umbrella for a while at least. I'm probably wrong then :)



Graydon tweeted https://twitter.com/graydon_pub/status/761280391239958528 and it's all clear now: the Mozilla Summit session was called "Project Servo" but focused more on Rust, and Graydon's slides had that phrase as title:

http://venge.net/graydon/talks/intro-talk-2.pdf

(also picked up on my T2 robot from the future joke and reversed it, lol). But Rust was Rust, even then. Servo was the big news, I think Rust was known within Mozilla, a bit. So we used Servo in the session name and the rest is history.


> and AFAIK wouldn't be able to 100% obviate Gecko's current renderer, for legacy reasons(?)

I assume they'll make the cut-over at some point as WebRendern should run on most post-2010 hardware. Will Mozilla drop support Firefox for those oldest machines? We don't know, they don't seen to have developed a strategy as yet.

There are software shims for GPUs that can't provide the required OpenGL features but performance is awful.


> There are software shims for GPUs that can't provide the required OpenGL features but performance is awful.

WARP and SwiftShader are better than you might think.


I believe we did an experiment with llvmpipe which wasn't nearly as fast as webrender on a GPU, but was faster than the other software renderers.

So there is some reason to hope for a very easy software fallback that is still competitive with other software renderers.


From the slides:

   Clipping an axis-aligned rectangle to another axis-aligned 
   rectangle produces at most one axis-aligned rectangle. 
What if the object in front overlaps only one corner of the one in back? That results in two rectangles.

Or if it's entirely within the outer rect...?


Clipping in (intersection), not clipping out (difference).


I didn't expect this to hit HN so soon!

Feel free to try WebRender 2 out--it should hit nightlies within a day or two--but note that this is still under heavy development, and there are a lot of very important optimizations that have yet to be implemented. The primary focus so far has been correctness and validation of the approach.

At some point either gw or I will probably write up an overview of how WebRender 2 works. It's conceptually similar to, and shares most of the code with, the original WebRender. Briefly, the main advantage of WebRender 2 is that it uses an approach loosely akin to tiled deferred rendering to minimize overdraw, whereas the original WebRender more or less performed forward rendering only. We also have a path forward to subpixel AA (though not implemented yet) without requiring readback, expensive framebuffer ping-pong, or GL extensions.


Have you measured the difference in performance between WR1 and WR2?


Can someone explain the significance of this?


WebRender 2 is just the next evolution of WebRender. After we started testing the original one on real sites and apps, we discovered a few performance problems. Glenn had some ideas for how to fix them that involved changing quite a lot of things, and that work is now landed in the tree.

One consequence of this work, other than speed of course, is that it enables things like subpixel AA, which weren't possible before.

Externally we'll probably just call it WebRender. Not many people knew about the first one and most users won't care that it took us a few iterations to perfect :)

We're planning to turn WebRender 2 on as the default very soon.


Congrats on landing WebRender 2.

> "Externally we'll probably just call it WebRender. Not many people knew about the first one and most users won't care that it took us a few iterations to perfect :)"

It's your choice, but considering the audience of people interested in browser features (especially browser features for Servo) is largely tech savvy, I'd recommend against it. Of the examples I can think of where version numbers have been messed with, I can't think of a single one that hasn't caused unnecessary issues (Final Fantasy 3/6, the "new" iPad, XBox One).


> things like subpixel AA

Did you mean subpixel anti aliasing ? Wow, that sounds cool. Where can I read more about this ?


This is incomplete, but my basic understanding is as follows.

Servo is an experimental web browser in Rust.

WebRender was an experiment inside an experiment, to use a GPU pipeline closer to what a video game does and do painting very quickly. See a previous HN discussion: https://news.ycombinator.com/item?id=11175258

WebRender 2 I'm less familiar with, but it's a continuation on that work. I gather it cuts down on the amount of painting done, so now it does painting fast, and does less of it. I gather it should also enable some new features, like subpixel antialiasing.


Here's the only thing I could easily find via Google [0]:

"The basic design right now is that we draw every pixel of every frame, but there's a lot of overdraw when things overlap. This shows up in the moiré demo where there's a lot of overlap. Also we don't have enough information to do subpixel antialiasing. gw had a great idea to solve both of these problems. The prototype he built uses a ray tracer to trace through all of the objects and draw each pixel only once. That should lead to new features like subpixel AA and also more consistent performance."

More context would be appreciated, though!

[0] https://github.com/servo/servo/wiki/Meeting-2016-03-07


Also in a previous webrender discussion on hn pcwalton credited the design of the original webrender to gw as well.


Webrender is a renderer that use gpu techniques similar to how games render.


A slide deck from February which explains how Webrender works is available from the developers [1].

[1] http://pcwalton.github.io/slides/webrender-talk-022016/



Are there any browsers (experimental or not) that actually use this?


Experimental, yes; You can download nightlies of Servo at https://servo.org/, which use Servo together with browser.html, a HTML+CSS+JS-based browser chrome developed for the purpose of showing off Servo.


Though the nightlies won't be using WR2 until tomorrow.


Besides the WebRender2 itself, nice to see the Amiga logo.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: