Direct 2D Firefox: Internet rendered on your GPU

Tempered81

Diamond Member
Jan 29, 2007
6,374
1
81
Hi everybody


If you have a Direct3d10 GPU and a good cpu (tester used a corei7 920 and hd4850) you can use a beta version of Firefox 3.7alpha to render the entire firefox program and web content on your GPU.

The best part of it is that it improves speed and decreases page load times by offloading work from the CPU!

Direct2D usage in Firefox
A while ago I started my investigation into Direct2D usage in firefox (see bug 527707). Since then we've made significant progress and are now able to present a Firefox browser completely rendered using Direct2D, making intensive usage of the GPU (this includes the UI, menu bars, etc.). I won't be showing any screenshots, since it is not supposed to look much different. But I will be sharing some technical details, first performance indications and a test build for those of you running Windows 7 or an updated version of Vista!

Implementation
Direct2D has been implemented as a Cairo backend, meaning our work can eventually be used to facilitate Direct2D usage by all Cairo based software. We use Direct3D textures as backing store for all surfaces. This allows us to implement operations not supported by Direct2D using Direct3D, this will prevent software fallbacks being needed, which will require readbacks. Since a readback forces the GPU to transfer memory to the CPU before the CPU can read it, readbacks have significant performance penalties because of GPU-CPU synchronization being required. On Direct3D10+ hardware this should not negatively impact performance, it does mean it is harder to implement effective D2D software fallback. Although in that scenario we could continue using Cairo with GDI as our vector graphics rendering system.
Internally here's a rough mapping of cairo concepts to D2D concepts:
cairo_surface_t - ID2D1RenderTarget
cairo_pattern_t - ID2D1Brush
cairo clip path - ID2D1Layer with GeometryMask
cairo_path_t - ID2D1PathGeometry
cairo_stroke_style_t - ID2D1StrokeStyle
More about the implementation can be learned by looking at the patches included on the bug! Now to look at how well it works.

Website Benchmarks
First of all let's look at the page rendering times. I've graphed the rendering time for several common websites together with the error margin of my measurements. The used testing hardware was a Core i7 920 with a Radeon HD4850 Graphics card:
There's some interesting conclusions to be drawn from this graph. First of all it can be seen that Direct2D, on this hardware, performance significantly better or similarly on all tested website. What can also be seen is that on complexly structured websites the performance advantages are significantly less, and the error margin in the measurements can be seen to be larger (i.e. different rendering runs of the same site deviated more strongly). The exact reasons for this I am still unsure of. One reason could be is that the websites contain significant amounts of text or complex polygons as well, for those scenarios with few transformations and blending operations the GPU will show smaller advantages over the CPU. Additionally the CPU will be spending more time processing the actual items to be displayed, which might decrease the significance of the actual drawing operations somewhat.

Other Performance Considerations
Although the static website rendering is an interesting benchmarks. There are other, atleast as important considerations to the performance. As websites become more graphically intense dynamic graphics will start playing a larger role. Especially in user interfaces.
http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser

D2DGDIPerf1.png


download:
http://www.bassified.nl/firefox-3.7a1pre.en-US.win32.d2d.2009.12.13.zip
 
Last edited:

MrK6

Diamond Member
Aug 9, 2004
4,458
4
81
Wow, pretty interesting. FWIW, I don't think I'll notice the difference between 8ms and 10ms. Is it better with Flash content? Thanks for posting.
 

Wreckage

Banned
Jul 1, 2005
5,529
0
0
combine this with flash acceleration and a netbook is starting to look a lot more appealing to me.
 

Hyperlite

Diamond Member
May 25, 2004
5,664
2
76
Interesting. Never going to notice the speed increase, but interesting. This could be useful on Allendale with near 0 I/O latency.
 

yh125d

Diamond Member
Dec 23, 2006
6,907
0
76
TL;DR, but unless theres just a bunch of heavy flash isn't the bottleneck almost always network as long as you have a decent CPU?

But yeah, if this works out well, and adobe gets off their arse with flash acceleration, netbooks would be even more functional. I just might buy one of the atom replacements (pineview?)
 

Fox5

Diamond Member
Jan 31, 2005
5,957
7
81
I think Linux technically already supported this for Firefox, yet firefox is dog slow on it.
 

Qbah

Diamond Member
Oct 18, 2005
3,754
10
81
Works as "fast" as standard Firefox for me. At least no difference when scrolling zoomed pages (like Facebook) - still lags (not as bad as IE8, but Chrome is still faster and Safari the fastest when zoomed).
 

akugami

Diamond Member
Feb 14, 2005
5,654
1,848
136
My worry is power consumption. Even though they have low power states, GPU's are notoriously power hungry. When you start running all kinds of acceleration on GPU's I'm afraid of having lower battery life on laptops. For desktops this is obviously not a problem. Unless you can't afford your electric bill.
 

yh125d

Diamond Member
Dec 23, 2006
6,907
0
76
My worry is power consumption. Even though they have low power states, GPU's are notoriously power hungry. When you start running all kinds of acceleration on GPU's I'm afraid of having lower battery life on laptops. For desktops this is obviously not a problem. Unless you can't afford your electric bill.


No, generally speaking if something can be programmed to run well on a GPU, it will generally be MUCH cheaper power wise to do it on such a GPU


Ex. F@H Q6600 vs 8800GT - Similar power usage, but the 8800GT will run circles around it in PPD. CPUs are great multitaskers, GPUs are great efficiency at their limited range of function. If you can make what you want to get done fit in that range of function, it will be done much faster and with much less power on a GPU
 

sandorski

No Lifer
Oct 10, 1999
70,098
5,639
126
Hmm, interesting. Not sure if I will ever bother using this, but this could certainly be our first sign of future Computing. The close integration of CPU-GPU could be the next major step up in performance. All we need now is an OS that can efficiently offload Tasks to either as needed.
 

v8envy

Platinum Member
Sep 7, 2002
2,720
0
0
And, it might herald the re-birth of PC gaming. Up to now the general public had no need for powerful '3d' hardware. If GPU accelerators are useful for general purpose tasks like web browsing you might find them standard in commodity PCs. Which means game developers and publishers suddenly have a larger market.

The death of PC gaming tracks the popularity of Intel video hardware rather well. Increased install base of GPUs can only be a good thing.
 

Griswold

Senior member
Dec 24, 2004
630
0
0
No, generally speaking if something can be programmed to run well on a GPU, it will generally be MUCH cheaper power wise to do it on such a GPU


Ex. F@H Q6600 vs 8800GT - Similar power usage, but the 8800GT will run circles around it in PPD. CPUs are great multitaskers, GPUs are great efficiency at their limited range of function. If you can make what you want to get done fit in that range of function, it will be done much faster and with much less power on a GPU

Just that this logic doesnt have the same result everywhere. For it to be true, the GPU does indeed have to run circles around a CPU. 6ms faster rendering at most is a joke nobody will understand, though.

At best, it wont make a difference, both in power consumption but definitely in subjective perception.

To me, a thing I dont need now and in the forseeable future.
 

yh125d

Diamond Member
Dec 23, 2006
6,907
0
76
Thats why theres the qualifier "if something can be programmed to run well on a GPU, it will generally be MUCH cheaper power wise to do it on such a GPU"
 

StrangerGuy

Diamond Member
May 9, 2004
8,443
124
106
If there is one thing I noticed over the years, is that browsers and especially Flash have been getting slower, despite running on ever better CPUs.

It's nonsense to see my 2.4GHz A64 choking on Firefox with heavy Flash while my Athlon XP years ago would never, ever got this slow.
 

tommo123

Platinum Member
Sep 25, 2005
2,617
48
91
hope opera gets something like this. reload all on 50 or so tabs makes my PC spit at me at times. (yes i need all tabs :p )
 
Nov 26, 2005
15,092
312
126
Your FF version? Nightly Tester Tools can force add-on installs on newer versions, which more likely than not work fine.

Nightly tester tools is will force the install even if the app is not compatible? I think my main gripe was Save Session which someone pointed out that the newer versions had it but the newer versions didn't act the same way Save Sessions does.
 

Avalon

Diamond Member
Jul 16, 2001
7,565
150
106
Was playing around with it earlier, pretty neat. There seems to be a bit of a difference on heavy content sites.
 

EarthwormJim

Diamond Member
Oct 15, 2003
3,239
0
76
I'd like to see a comparison between browsing on a CPU at 100% usage say encoding a video, with and without this GPU rendering.
 

akugami

Diamond Member
Feb 14, 2005
5,654
1,848
136
No, generally speaking if something can be programmed to run well on a GPU, it will generally be MUCH cheaper power wise to do it on such a GPU


Ex. F@H Q6600 vs 8800GT - Similar power usage, but the 8800GT will run circles around it in PPD. CPUs are great multitaskers, GPUs are great efficiency at their limited range of function. If you can make what you want to get done fit in that range of function, it will be done much faster and with much less power on a GPU

F@H is a use that is suited for GPGPU. I just question whether accelerating web pages and stuff like Flash is worth the higher GPU power consumption on mobile devices like laptops. Obviously, on a desktop it wouldn't matter.

Personally, I always use the Flashblock plugin for Firefox which helps speed things up. I'm also not a fan of sites that make use of heavy graphics just to make it "flashy" so to speak. Good web design should be enough to make most sites fast. For instance, some sites are almost entirely coded in Flash and other technologies when they could easily make a site using less processor intensive technologies and have it look just as good.

Not here to try to limit Web 2.0 or Web 3.0 or whatever implementations. It's just that sometimes people just want to implement the technology du jour without properly designing a product to fit their customer/viewer's needs.
 

yh125d

Diamond Member
Dec 23, 2006
6,907
0
76
F@H is a use that is suited for GPGPU. I just question whether accelerating web pages and stuff like Flash is worth the higher GPU power consumption on mobile devices like laptops. Obviously, on a desktop it wouldn't matter.

Personally, I always use the Flashblock plugin for Firefox which helps speed things up. I'm also not a fan of sites that make use of heavy graphics just to make it "flashy" so to speak. Good web design should be enough to make most sites fast. For instance, some sites are almost entirely coded in Flash and other technologies when they could easily make a site using less processor intensive technologies and have it look just as good.

Not here to try to limit Web 2.0 or Web 3.0 or whatever implementations. It's just that sometimes people just want to implement the technology du jour without properly designing a product to fit their customer/viewer's needs.

Once again, If it can be coded to run well on a GPU