News for hackers. Stuff that matters.
Re:The web at maximum FPS: How WebRender gets rid of jank by nonsince on Tuesday October 10, 2017 @02:01PM (#15443906)
Your browser is doing ~60fps rendering on the GPU already, it's just doing it much less efficiently. This does less work on the CPU _and_ less work on the GPU, for the same result.
Re:The web at maximum FPS: How WebRender gets rid of jank by Ajedi32 on Tuesday October 10, 2017 @03:11PM (#15444502)
I'll admit I'm certainly not an expert on browser rendering pipelines, but that's not the impression the article gave. Rather, it suggested that current browser engines may, in fact, be more efficient in terms of the absolute number of computations done.

When discussing existing browsers:

> But often the things on these layers didn’t change from frame to frame. For example, think of a traditional animation. The background doesn’t change, even if the characters in the foreground do. It’s a lot more efficient to keep that background layer around and just reuse it.

> So that’s what browsers did. They retained the layers. Then the browser could just repaint layers that had changed.

Then, later in the article, when discussing WebRender:

> What if we removed this boundary between painting and compositing and just went back to painting every pixel on every frame?

(Emphasis mine.)

So is WebRender less efficient in terms of power usage? Or is there some other factor that offsets the cost of this extra work?

Re:The web at maximum FPS: How WebRender gets rid of jank by Ajedi32 on Tuesday October 10, 2017 @03:43PM (#15444766)
There's some interesting discussion about this very topic happening on /r/rust right now: https://www.reddit.com/r/rust/comments/75hzk5/the_whole_web_...

A particularly relevant bit:

> For the case where the CPU would have painted a single pixel, WR will certainly use a bit more power than CPU rendering with a compositor. For the case where a large portion of the screen changes, CPU renderers might miss their frame budget spending > 16ms drawing a frame, where WR will complete that task in 4ms.

> We might light up part of a GPU for longer than compositing would have, but we just saved >12ms of CPU compute. The power hypothesis is that the saved CPU compute consumes more power budget than the extra GPU compute we added. If there was no further JS code to run (app is idle) then we can go back to idle state after 4ms, instead of after 16+ms.

Re:The web at maximum FPS: How WebRender gets rid of jank by benjaminjackman on Wednesday October 11, 2017 @08:05AM (#15449029)
Hmm that sounds like outside of missed frames or otherwise busy sites consistently using more than 25% of the frame budget more power will be required by the new approach. Isn’t that going to be the most common case?
Re:The web at maximum FPS: How WebRender gets rid of jank by nicalsilva on Tuesday October 10, 2017 @07:20PM (#15446092)
It depends. For a lot of web pages, the things webrender do are actually very simple and can be faster than Firefox's compositor even if there was no painting required. The expensive stuff like rasterizing glyphs are cached. The idea is that if we can render everything at a cost that is equivalent to that of the compositor, then the benefits of the compositing infrastructure aren't clear anymore. For sure there will be pages where the compositor would have been faster for frames where no painting was required, at the end of the day it's a new architecture with new tradeoffs, but the goal is to be overall (much) faster.
Re:The web at maximum FPS: How WebRender gets rid of jank by RussianCow on Tuesday October 10, 2017 @02:03PM (#15443929)
I don't think this is actually true. If you're looking at a static page that doesn't change in any way, isn't the browser completely idle?

Edit: To clarify, I realize that the screen gets refreshed ~60 times per second (depending on refresh rate), but I don't think any rendering actually happens if it doesn't need to.

Re:The web at maximum FPS: How WebRender gets rid of jank by ricardobeat on Tuesday October 10, 2017 @02:15PM (#15444033)
The GPU is still painting the screen at a set refresh rate (your monitor’s). Some monitors have variable refresh rates, but don’t go any lower than 30hz, and depending on settings like vsync the gpu might still be churning through hundreds of wasted frames. The latest iPads can go down to 24hz to save energy due to their custom 120hz display, but that’s a rarity.
Re:The web at maximum FPS: How WebRender gets rid of jank by nicalsilva on Tuesday October 10, 2017 @07:02PM (#15446025)
Let's clarify, WebRender doesn't do anything at all if nothing changed. If the content of the window is static then webrender won't wake your gpu up until it really needs to. There seem to be a confusion about video games needing to render at constant frame rate, but that is only the case in games where there is always something changing on screen. It isn't that uncommon for other types of games with more static graphics to not render if nothing has changed.
Re:The web at maximum FPS: How WebRender gets rid of jank by Dylan16807 on Wednesday October 11, 2017 @04:45AM (#15448224)
What about if a tiny thing changes? Perhaps animated avatars totaling 1% of the page. Is that a scenario where the new method might use more power, because it redraws too much?
Re:The web at maximum FPS: How WebRender gets rid of jank by nicalsilva on Wednesday October 11, 2017 @05:44PM (#15453767)
As pcwalton said, there is a whole lot of things on the web that are very cheap to render on a GPU if done right. For these things, a well tuned gpu renderer can easily outperform a naive compositor like what you can see in most browsers. All of the caching optimizations that one gets from a compositor can be incorporated in something like webrender (and some are, like glyphs and a bunch of other stuff). Right now webrender doesn't have all of the tweaks to avoid rendering the whole page when there is a small spinning throbber, but that will be implemented eventually (there is still a lot of work going into rendering the long tail of weird and specific things right).
Re:The web at maximum FPS: How WebRender gets rid of jank by pcwalton on Wednesday October 11, 2017 @01:20PM (#15451401)
A compositor is already repainting the whole window on the GPU. WR doesn't change anything here.
Re:The web at maximum FPS: How WebRender gets rid of jank by nicalsilva on Wednesday October 11, 2017 @05:31PM (#15453668)
Actually, Gecko's compositor knows the screen space invalid region and scissors out the rest when compositing. The invalid region is passed to the window manager. Chromium also does that although they settle for an invalid rect instead of region which is fair. There is an issue on file to do the same with webrender.
Re:The web at maximum FPS: How WebRender gets rid of jank by Dylan16807 on Wednesday October 11, 2017 @03:56PM (#15452882)
In this use case the "painting" a compositor does from layers is copying one big rectangle. That takes next to zero time. That's not at all similar to "painting" where you actually re-render the entire visible portion of the page.
Re:The web at maximum FPS: How WebRender gets rid of jank by pcwalton on Wednesday October 11, 2017 @04:07PM (#15452987)
> That's not at all similar to "painting" where you actually re-render the entire visible portion of the page.

Why not?

Painting a page is mostly just copying pixels from textures too.

Re:The web at maximum FPS: How WebRender gets rid of jank by Dylan16807 on Wednesday October 11, 2017 @06:34PM (#15454140)
You don't see a notable difference between [tens of] thousands of glyphs and bits being layered on top of each other and processed through a display list, versus copying over one single rectangle from A to B?
Re:The web at maximum FPS: How WebRender gets rid of jank by pcwalton on Wednesday October 11, 2017 @06:48PM (#15454230)
No, I don't. It adds a small amount of vertex shading time. The GPU primitive rasterization machinery is extremely good.

Benchmark it yourself if you don't believe me!

Re:The web at maximum FPS: How WebRender gets rid of jank by vetinari on Tuesday October 10, 2017 @02:29PM (#15444158)
In this case, the GPU just sends the content of the framebuffer to the screen. It does not re-render the content of the framebuffer, which is what the most energy is usually spent on.
Re:The web at maximum FPS: How WebRender gets rid of jank by jug on Tuesday October 10, 2017 @03:37PM (#15444715)
Also I imagine that particular path of simply sending the framebuffer is a highly optimized one.
Re:The web at maximum FPS: How WebRender gets rid of jank by zlynx on Tuesday October 10, 2017 @03:16PM (#15444547)
Intel GPUs support Panel Self Refresh. Tablet and laptop panels can go very slow. Less than 24 FPS, for sure! It is whatever the low end is on their LCD controller (they forget over time, like DRAM).

This article has some diagrams and explanations: http://www.hardwaresecrets.com/introducing-the-panel-self-re...

Re:The web at maximum FPS: How WebRender gets rid of jank by vvanders on Tuesday October 10, 2017 @02:25PM (#15444119)
It depends on the GPU arch. Some of them use a separate 2D compositor that uses much less power so if you're just scrolling layers you aren't lighting up the full GPU.
Re:The web at maximum FPS: How WebRender gets rid of jank by s_ngularity on Tuesday October 10, 2017 @02:13PM (#15444012)
The GPU is drawing 60 times a second regardless of whether the page is static. Not sure how they do their streaming to the GPU, but there will be state changes every time you scroll, or click a button, etc., even on a static page.
Re:The web at maximum FPS: How WebRender gets rid of jank by rayiner on Tuesday October 10, 2017 @03:20PM (#15444576)
There is a difference between drawing the frame into the frame buffer, and scanning the frame buffer out to the display. If you application is coded at all sanely, only the latter is happening at 60 Hz with a static page.
Re:The web at maximum FPS: How WebRender gets rid of jank by TickleSteve on Tuesday October 10, 2017 @02:17PM (#15444053)
no, the GPU is refreshing the video output at 60Hz, the graphics are not being redrawn at 60Hz in your typical GUI application. Games are a special case of course.
Re:The web at maximum FPS: How WebRender gets rid of jank by pohl on Tuesday October 10, 2017 @02:21PM (#15444079)
The specs for my mobile GPU say that it has 1024 cores. Wouldn't it be surprising if they were all fully active regardless of workload? (It seems like low-hanging fruit for making a laptop GPU energy efficient.)