News for hackers. Stuff that matters.
Re:Servo, the parallel browser engine written in Rust by amelius on Saturday May 27, 2023 @06:59AM (#36093682)
Cynical prediction: by the time this project is finished, the entire rendering of browsers happens in the GPU.
Re:Servo, the parallel browser engine written in Rust by psychphysic on Saturday May 27, 2023 @07:25AM (#36093807)
Is this now intended to be a full featured browser? That'd be great.

Last I checked this was going to be a sandbox for Rust ideas with no intention of Gecko bring dropped by Firefox.

It would be cool if it could at least be a "secure" window with heavy restrictions on add-ons etc. Not full featured, maybe not even much hardware acceleration. Just a single window that is super hardened.

Re:Servo, the parallel browser engine written in Rust by maksimur on Saturday May 27, 2023 @07:26AM (#36093811)
I hope not, unless GPUs become cheaper.
Re:Servo, the parallel browser engine written in Rust by capableweb on Saturday May 27, 2023 @07:37AM (#36093873)
How much cheaper can they get? Most laptops have CPUs/boards with integrated GPUs, and desktop GPUs can be bought for very cheap, as long as you don't buy the latest greatest edition of everything.
Re:Servo, the parallel browser engine written in Rust by rollcat on Saturday May 27, 2023 @08:58AM (#36094434)
It's hard to lose on this one: even an underpowered, integrated GPU will probably do a better job than an average CPU. Desktops have figured this out a while ago, both OSX and Windows have been rendering on the GPU for a very long time and it's not necessarily to enable any extra graphical effects, but just to make the interaction faster, smoother, and more energy-efficient.
Re:Servo, the parallel browser engine written in Rust by the_third_wave on Saturday May 27, 2023 @07:32AM (#36093844)
Who knows? A rendering engine will still be needed though so another prediction could be that Servo supports such GPU-based rendering.

Maybe a better prediction would be for the CPU/GPU/MPU/APU/xPU distinction to become less relevant since processors will gain those capabilities? A future where processors come in chiplet-based packages with a few generic cores and some more tailored to massively parallel matrix processing maybe?

Re:Servo, the parallel browser engine written in Rust by GuB-42 on Saturday May 27, 2023 @07:54AM (#36093953)
GPU probably won't be a good fit for the browser, except for purely graphical tasks, like drawing images, for which they are already used for.

GPUs are good for massively parallel tasks, for example, shading every individual pixel on a 3D rendered scene, which is what they are designed for, bruteforcing hash functions, as it is done in cryptocurrency mining, or multiplying large matrices, as it is done in deep learning.

But most of what a browser does is not massively parallel. JS is mostly single-thread, and layout, parsing HTML, or managing network connections may benefit from a bit of parallelism but we are not talking about thousands of simultaneous operations with no interdependence. And for that, GPUs suck, they don't have the caching, branch prediction, synchronization, etc... abilities of a CPU, and attempting to do that on a GPU will only bring it down while its overpowered math units will be idling.

Re:Servo, the parallel browser engine written in Rust by loa_in_ on Saturday May 27, 2023 @08:40AM (#36094269)
Some things that come to mind: layer compositing, layer transformations, animation (deferred from CPU)
Re:Servo, the parallel browser engine written in Rust by sebzim4500 on Saturday May 27, 2023 @11:02AM (#36095365)
GPUs are already doing all of those things in modern browsers.
Re:Servo, the parallel browser engine written in Rust by Dylan16807 on Saturday May 27, 2023 @03:37PM (#36097520)
Those sound like "purely graphical tasks" to me.
Re:Servo, the parallel browser engine written in Rust by GeekyBear on Saturday May 27, 2023 @08:08AM (#36094041)
Parts of Servo to enable the use of the GPU for compositing layers were merged into Firefox years ago.

https://hacks.mozilla.org/2017/10/the-whole-web-at-maximum-f...

It's a shame that Patrick Walton didn't get a chance to finish his work on the Pathfinder GPU renderer.

>Pathfinder 3 is a fast, practical, GPU-based rasterizer for fonts and vector graphics using OpenGL 3.0+, OpenGL ES 3.0+, WebGL 2, and Metal.

https://github.com/servo/pathfinder

Re:Servo, the parallel browser engine written in Rust by dralley on Saturday May 27, 2023 @10:05AM (#36094936)
I wonder if it would be easier to finish if based on a wgpu backend, rather than having 4 separate backends.
Re:Servo, the parallel browser engine written in Rust by mandarax8 on Saturday May 27, 2023 @12:00PM (#36095783)
Opengl3/es3/webgl2 might as well be the same backend
Re:Servo, the parallel browser engine written in Rust by abrztam on Saturday May 27, 2023 @08:19AM (#36094128)
Yes, ads running on the GPU are the future, unblockable.
Re:Servo, the parallel browser engine written in Rust by sebzim4500 on Saturday May 27, 2023 @11:03AM (#36095374)
Why are ads on the GPU harder to block than ads on the CPU?
Re:Servo, the parallel browser engine written in Rust by Sesse__ on Saturday May 27, 2023 @10:25AM (#36095071)
The paint phase of rendering can easily happen on the GPU, and more and more stuff will move to the GPU as time goes by. The style and layout phases… unlikely.

Think of a GPU this way: If you could reasonably launch a thousand threads on the CPU and get a benefit from it—i.e., essentially, you have tens of thousands of largely independent work chunks (or more)—your problem might be well-suited to a GPU. A large web page contains a couple thousand DOM elements, and many of them depend on each other wrt. style, so it's not a good fit. (Stylo is parallelized, so it is capable of using a multicore CPU, but there's no way it can get a reasonable gain from 1000 cores.) Layout is also nontrivial to parallelize.

However, paint is a different beast. In many cases, you can do per-pixel parallel work. So various forms of font work, line/shape rendering, compositing/blending, scrolling, video decoding… that's where the GPU is useful.