
WebRender2 Lands in Servo - leeoniya
https://github.com/servo/webrender/pull/319
======
kibwen
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/](https://air.mozilla.org/bay-area-rust-meetup-
february-2016/)

WebRender 2 overview: [https://github.com/servo/servo/wiki/Webrender-
Overview#webre...](https://github.com/servo/servo/wiki/Webrender-
Overview#webrender-2-overview)

A short walkthrough of WebRender 2:
[http://www.masonchang.com/blog/2016/7/18/a-short-
walkthrough...](http://www.masonchang.com/blog/2016/7/18/a-short-walkthrough-
of-webrender-2)

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 ).

~~~
Manishearth
> 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

~~~
BrendanEich
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".

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

~~~
BrendanEich
[https://twitter.com/BrendanEich/status/761105563807731712](https://twitter.com/BrendanEich/status/761105563807731712)

[https://wiki.mozilla.org/Summit2010/Schedule](https://wiki.mozilla.org/Summit2010/Schedule)
(find "Servo Project")

~~~
BrendanEich
Graydon tweeted
[https://twitter.com/graydon_pub/status/761280391239958528](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](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.

------
pcwalton
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.

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

------
josephg
Can someone explain the significance of this?

~~~
metajack
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.

~~~
ZenoArrow
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).

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

~~~
adambrenecki
Experimental, yes; You can download nightlies of Servo at
[https://servo.org/](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.

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

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

