Bas
2010-03-02

Presenting: Direct2D Hardware Acceleration In Firefox Nightlies

So, the moment is finally there! I realize I've not posted on here for a while, my main reason being I wanted to be able to actually have something to tell you guys the next time I would talk about Direct2D. And it seems that now I do! After a lot of hard work from myself and many others at Mozilla who have been assisting me in getting Direct2D and particularly DirectWrite stable and functional enough for people to start trying it out, I believe our Direct2D support is now ready for the world to try their hands at!

If you download the latest nightly here you will be the proud owner of an official experimental build that has support for Direct2D. This build will automatically update to our new experimental nightly builds, giving you all the bugfixes we're working on for various problems that are still around.

Does that mean if I download the latest nightly I get Direct2D support?

Well, no. Since we don't want to regress any functionality in our browser for the majority of our users, by default your build will not use DirectWrite. There's a couple of steps you'll need to execute to get it working:

  1. Go to about:config
  2. Click through the warning, if necessary
  3. Enter 'render' in the 'Filter' box
  4. Double-click on 'gfx.font_rendering.directwrite.enabled' to set it to true
  5. Double click on 'mozilla.widget.render-mode', set the value to 6
  6. Restart

So once I've done this, surely I have this Direct2D support going!

Erm... sorry here folks, but no. There's several reasons why you could still not be having Direct2D support. First of all it's possible you have an extension interfering with Direct2D. Several extensions are known to somewhat disrupt our initialization order, meaning the preferences you've just set are not accessible during initialization of the render mode, which will cause GDI default render-mode.

Then there is another issue, if you're actually on Windows XP and not on Windows Vista or Windows 7, Windows XP actually has no support for Direct2D or DirectWrite, so it will fallback to being just a normal build. I suggest you upgrade :D.

Finally, if you do not have a high-end DirectX 9 graphics card, or a DirectX 10 graphics card, insufficient hardware support will be detected. This will cause the renderer to fallback to using GDI as well, in order to prevent you from suffering a slow browser, or even worse, a crash!

Now, all this reading, by now I must have Direct2D support?!

Right, if you satisfy all the above conditions, you're probably there! We don't have any way to verify at the moment (we're working on something), but one way is to go here. If it runs nice and smooth when you size photos up to fullscreen, it's working!

It is working! Now what?

You should enjoy your new browsing experience, in most cases you should have a noticeably faster and more responsive browser, particularly when using graphically intensive websites (not using flash, which will still be slow). If you find any bugs, please use our traditional reporting method of going to bugzilla and see if they've already been filed. If they haven't, file it, and we'll try to get to it and fix it as soon as possible!

There's a very cool forum thread that tracks the currently known issues, you should have a look there as well.

Well, that's about it!

I apologize to everyone for taking so long to get this ready for putting it out there, and for not providing experimental builds over the last months. The fact is its surprising how much you can do on the web that at least I didn't know about! And in how many interesting ways it can break &#59;). But I hope you can now all enjoy the latest and greatest of Direct2D builds. And no longer suffer any manual updating of your build! Happy Browsing!

59 comments

# marek on 2010-03-02 at 17:09
Great great great! It's amazingly fast, thank you (Cavern Fighter game especially).
I'm switching to D2D browsing as my default at home and will see, if it will work without crashes or so...
# Paul on 2010-03-02 at 17:22
Awesome :)
# Chris on 2010-03-02 at 17:40
Wonderful. I'm running it since yesterday. The best thing: it doesn't crash anymore on the Sunspider site :)
There are render issues with @font-face and white font on black background but all in all it works amazingly well.
Thanks for all your work, I'm looking forward to seeing it evolve!
# John on 2010-03-02 at 18:03
Excellent!

However I have a problem: the browser's GUI seems to draw very slowly. For example just moving the mouse pointer between tabs uses 100% of one CPU core just for the hover effect. Opening and closing tabs feels very sluggish for the same reason. Which is strange given that web pages render at the speed of light.

Is this a known problem or should I file a bug?

Thanks for your work!
# antistress on 2010-03-02 at 18:10
I've also seen that you've worked hard on Layers which should land in mozilla1.9.3a3
If i understand things correctly, it would enable hardware acceleration on Linux for things like YUV/RGB transcoding.
Do you know when we will be able to test it ?
# Mucinch on 2010-03-02 at 18:14
Awesome work!

Can you put together a generic list of GPUs (like nvidia above 8800GT, AMD above 4350 etc) that supports D2D? There is currently a lot of confusion in the forums with D2D support.
# Bas [Member] Email on 2010-03-02 at 18:19
@John: It is a known problem to do with silly alpha recovery being run where not needed for UXTheme stuff. There's a patch up for review in https://bugzilla.mozilla.org/show_bug.cgi?id=548072. After that we should be close to fixing it.

@antistress: The D3D10 backend will have a patch for a basic implementation end of this week. I'm aiming to have an OGL 2.1 backend Fri 19th.

@Mucinch: I wish I had such a list. Currently DX 10+ cards are a good bet. D3D 9 I'm very confused on :)
# Mucinch on 2010-03-02 at 20:38
When OGL 2.1 backend lands, will XP users see an improvement in speed?
# Dizzy on 2010-03-03 at 11:22
Hello.
Great work with D2D and DirectWrite, but I have a problem since the firs time I enabled D2D. About 75% of the time a new tab loads into a completely grey area. The page loads ok behind (the mouse changes when hovering over links etc), but it doesn't get drawn until I switch to another window/tab and back.

Running latest nightly (20100302) on Vista64, Radeon HD 5870 with Catalyst 10.2.
# Jonathan on 2010-03-03 at 15:38
A small word of warning for people who like to experiment: if you set the mozilla.widget.render-mode preference to 6, to try out D2D, and then go back to running the released Firefox 3.6 (with the same profile), rendering will be completely broken - all windows appear blank.

This is due to a bug in 3.6; I hope it will be fixed in an update soon, but for the time being - beware! Reset the preference before going back to "standard" Firefox, or use separate profiles.
# Howdy on 2010-03-03 at 15:47
Works great for me so far. Although I was surprised that I had to disable Adblock Plus in order for D2D to kick in.
# antistress on 2010-03-04 at 12:08
@ Bas : thanks for the answer.
Can Layers also be used to accelerate SVG for instance ?
And is all the thing handle by Firefox or developers have to complete their code ?
# Bas [Member] Email on 2010-03-04 at 13:22
@antistress: Layers will not really accelerate SVG it will only accelerate surface composition. Although in some cases this could be used to accelerate some aspects of SVG (filters for example). But it will not give the performance improvements in rasterization that D2D does. Firefox will handle all of this, it will be completely transparent to web developers.
# antistress on 2010-03-04 at 14:16
thanks again (for answers and your work)
# Chris Moeller on 2010-03-04 at 16:28
@Howdy: A recent dev build of Adblock Plus works with D2D.
# Howdy on 2010-03-04 at 20:57
@Chris: Thanks. I got it and it works.

I've also noticed now that webgl apparently doesn't work when directwrite is enabled.
# antistress on 2010-03-05 at 00:19
I'm really interested in that question and i've made some researches over the web to try to understand

With new OpenGL backend for Cairo (without glitz) [1], is Layer still needed to have Cross-Platform Acceleration ? I guess that OpenGL backend for Cairo could be more versatile than Layers (i.e. being able to accelerate videos but also SVG etc.) ?

Or is OpenGL backend for Cairo still incomplete as said here [2] ?

[1] http://lists.cairographics.org/archives/cairo/2009-July/017713.html
[2] http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser#c60
# Bas [Member] Email on 2010-03-05 at 00:40
@antistress: As far as I know it's quite far from ready. Atleast the performance is nowhere near that of Direct2D.
# henk on 2010-03-05 at 23:33
This looks very nice indeed. Unfortunately it's rather useless to me since I'm on OS X.

Any chance anything comparable will be done for OS X users?
# Jon on 2010-03-06 at 11:07
When will this land in the browser proper, 4.0?
# scorpeeon on 2010-03-06 at 17:58
Hello there!

I have a pretty strange problem: Direct2D is not working with this version (3.7a3), i can clearly see this on the texts look and SVG being slow, but it DOES work with the previous 3.7a1pre. I changed to about:config settings too, but it didn't help. in 3.7a1 it works by default..

I have Win7, HD4670 (DX10.1), latest Catalyst installed..
# Doug on 2010-03-06 at 18:18
Hey Bas

Just checking if you've seen bug 549661? (didn't see your name in the bugmail list when I filed it)
# MASTAN on 2010-03-06 at 23:29
I confirm that D2D in FF 3.7 Alpha 2 is working with DX9 hardware, I've tested it on my netbook Acer 751h, which has GMA 500 videocard.
There's not much of acceleration due to poor GMA 500 performance, but text is smoothed and D2D is definitely on.
# Chris Moeller on 2010-03-08 at 11:03
Even better, this advertisement picture, only 26KB:

http://questionablecontent.net/images/scienceyaoi.gif
# Greisha on 2010-03-10 at 04:31
Is the font rendering supposed to be this bold and blocky or its a known problem? I miss the crispness of GDI fonts.
# why on 2010-03-10 at 11:29
Why not use Quartz on Mac Os X ? It is exactly like Direct2D (just 7 years before).
# Bas [Member] Email on 2010-03-10 at 13:29
@Dennis: Hrm, looks fine for me, can you post a screenshot?

@why: It's not exactly like Direct2D at all ;) But for what it's worth: we use it.
# antistress on 2010-03-12 at 00:06
@Bas :
1) I've made an article (in french) on Layers on my blog
http://libre-ouvert.toile-libre.org/?article13/

2) I've seen that article from Zack Rusin summarized on phoronix website http://www.phoronix.com/scan.php?page=news_item&px=ODA1OA about a new software rasterizer in Gallium3D
Will that benefit to svg rendering through Firefox ?
And could you explain why rasterization can't be accelerated with Layers whereas video transcoding can ?
Thanks in advance!
# Chris Moeller on 2010-03-15 at 19:20
This has no anti-aliasing in Direct2D mode:

http://desandro.com/articles/opera-logo-css/
# marek on 2010-03-17 at 10:00
I just noticed strange horizontal lines appearing during browsing page source, it makes it hardly readable.
You probably know about this but I just wanted to let not be forgotten ;-)
# Robert Hurst Email on 2010-03-18 at 07:25
Wow, This is going to be awesome once in the trunk build.
# Falko Meyer on 2010-03-18 at 16:50
I just had a look at the SVG test page and it did indeed run nice and smooth. It may not always have been two-digit fps rates, but ran surprisingly well.

What confuses me is that I'm using FF 3.6 on Debian with Intel chipset graphics.

Is the Direct2D mode supposed to significantly lower the CPU usage?
I had the Pentium D 3 Ghz used quite heavily during zooming and rotating the images.
# Totor on 2010-03-19 at 10:41
What about using OpenVG for SVG rendering accleration.
This hardware accelerated renderer is already managed by Mesa and all smartbook/smartphone devices...
# bernhard on 2010-03-19 at 10:58
webkit browsers also have hardware support but programming is not easy.

If you want to compare the speed of a web map
with Opera, Webkit und Firefox go to my website.

http://khtml.org
# Tom P on 2010-03-22 at 22:42
Cool deal.

What about supporting multiple processors (e.g. quad core)? Is that on the radar?
# Bas [Member] Email on 2010-03-23 at 03:26
@Falko: On linux you wouldn't be able to run Direct2D.. With Direct2D you'll easily see two-digit FPS, in many cases even three-digit :)

@Totor: OpenVG doesn't do everything we need to, and is poorly supported in many cases.

@Tom P: It's on the radar in several ways actually! I can't talk about it extensively right now, but it is!
# Stu on 2010-04-06 at 02:59
Are you going to push this upstream... will the Direct2D backend be in the next version of Cairo ?
# Bas [Member] Email on 2010-04-06 at 14:47
@Stu: It could be, although I'm not sure when it will be upstreamed, and if Cairo will accept it.
# Michael Adams on 2010-04-08 at 08:50
Found out about the settings via someone posting on Reddit. It looks gorgeous now!

Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a4pre) Gecko/20100320 Minefield/3.7a4pre (.NET CLR 3.5.30729)
# Micah LaCombe on 2010-04-08 at 17:07
I can't figure out why no one has done this sooner... I have been hoping to see this for years. Great work!

One caveat, I don't particularly like how all the fonts are anti-aliased.. is there some way to switch this off why still using D2D for page render?
# The DarkMaster on 2010-04-08 at 18:02
Well.. Firefox is a multiplataform browser. Is not better to use OpenGL to make hardware support avaiable on Linux, OSX and etc too? And more, D2D support only on Vista or 7? I prefer stay with XP and no hardware assist.
# qwez Email on 2010-04-08 at 18:10
I tried the above, downloaded the nightly build from yesterday (07/03-2010), however when entering the about.config I can not find the 'gfx.font_rendering.directwrite.enabled' setting. Iam running Windows Server 2008, any suggestion would be appriciated.
# Grant Harkus on 2010-04-08 at 18:58
So, are you intentionally leaving Linux users out in the cold?
# Bas [Member] Email on 2010-04-08 at 19:36
@Grant&DarkMaster: Read the rest of my blog. We are working on OpenGL for Linux and Mac. However there's no 2D accelerated graphics API quite as advanced and complete as Direct2D on those platforms.

Both through Layers and potentially in the future cairo-gl we are looking to bring acceleration to all our users as best as we can. But not using an advanced graphics API when we can to deliver better performance to our Windows 7 and Vista users would be silly.
# carol on 2010-05-15 at 14:28
i tried it on mmorpg.com and the text in there is off like
something is wrong tried to adjust cleartype in windows but i think its something else its not far off but a bit off like 15 or 20% too fat looking.aside from that small text issue no problem men this techno is great!test the photo thing its SOOO SMOOTH!
# NV on 2010-06-15 at 13:26
Nvidia users should update to the latest GeForce 257.21 WHQL drivers.

Desktop drivers

http://www.nvidia.com/object/win7-winvista-32bit-257.21-whql-driver.html

http://www.nvidia.com/object/win7-winvista-64bit-257.21-whql-driver.html

Notebook drivers

http://www.nvidia.com/object/notebook-winvista-win7-257.21-whql-driver.html

http://www.nvidia.com/object/notebook-winvista-win7-64bit-257.21-whql-driver.html
# Michael Adams on 2010-06-21 at 07:04
Using 257.21 drivers on Nvidia 9600: latest builds are cancelling out my right-click menu unless I restore the "-1" setting for render mode. :/
# Leon Sorokin on 2010-06-25 at 00:55
enabled it in my nightlies. it does work fast but fonts look significantly different than with GDI - they are more fuzzy and appear to be using Cleartype or something similar regardless of my global setting to disable it in W7x64.

any other reports about this?

thanks,
Leon
# Timur on 2010-06-26 at 20:47
Pro: With Direct2D enabled Firefox finally scrolls fast enough to keep up with the Hyperscrolling wheel on my Logitech mouse.

And CPU load is considerably lower for scrolling (zoomed) pages fast.

Con: Firefox 3.7aPRE6, 9600M GT (v257.21): Turning on Direct2D leads to Firefox' GUI elements *not* using Cleartype anymore. Instead classic gray-scale AA is used.

Text renderings of pages *do* still use Cleartype when it's turned on in Windows preferences, so it's only a GUI problem.

Using Backspace in this test field here (yes the one I'm currently typing in) leads to grey vertical lines appearing with certain deleted letter (like "f") in some lines. Seems to be a remain of the cursor vertical line. Also happens on blank lines when the cursor line is moved through them.
# Bas [Member] Email on 2010-06-27 at 01:33
@Timur: The vertical lines are a known issue and will soon be resolved.

The lack of cleartype on the UI is because since glass causes the UI window to be transparent, we can't draw cleartype to it. (Cleartype would require 3 component alpha for transparent surfaces). The fact GDI -does- draw cleartype to transparent surfaces could in a way be considered a GDI bug.
# Timur on 2010-06-30 at 15:51
Thanks for the quick response and explanation. Don't take this as a rant, I'm just giving feedback and describing my perception.

I noticed that IE8 doesn't use Cleartype for its URL box neither, but it's using *far* better anti-aliasing/font than FF4. The fonts in FF4's URL box and tabs look rather bad, as if they were interpolations from a non-native resolution.

The greyscaling doesn't provide suffient AA while adding some very unpleasant blur. I checked the NVidia settings and set them to override any application's AA settings, but nothing changed.

Have a look at this nearest neighbor zoom into a tab and URL. The "T" and part of an "m" in the tab and the "b" are so badly blurred that they are completely grey instead of black.

http://yfrog.com/0rff4aap

But even worse, the ClearType rendering of web-pages' fonts look worse/blurred, too. It's especially pronounced on "exotic" color combinations (like white text on orange ground). Is there any GPU driver setting that would affect this?

Feel free to contact me via email if you've got any questions that would spam the blog comments too much.
# hwti on 2010-07-07 at 21:44
I tested DirectWrite rendering on Minefield.
Fonts are more blurry than GDI (Cleartype enabled, but tuned to be less blurry than the default rendering).

This is the same strange rendering as IE9 preview : some words or letters are more blurry than others (but not the same on both browsers)
# MrChuckman on 2010-07-09 at 00:26
I know that this problem was brought up, but I was wondering if there was a way to fix the GUI edginess when I enable hardware acceleration. The tabs load slower, the text looks horrible, and the buttons on the tool bar look very rough.
# ShadowVlican on 2010-07-09 at 05:31
while black fonts on white background seem to render fine (bold fonts look kinda weird though), the white fonts on dark backgrounds look like utter crap
# Hassan on 2010-07-09 at 08:05
Fellows, this is awesome.
# Gabriel Dibble on 2010-07-13 at 19:20
My thanks for your efforts with Linux and your comments above explaining such.

My fingers are crossed for all your efforts and I am grateful to your team for everything :)

--
Humble Gentoo User
# NV on 2010-07-19 at 15:16
Nvidia users should update to the latest GeForce 258.96 WHQL drivers.

Notebook driver pages were still not up or were pointing to wrong filenames, so direct download links to the drivers included.

http://www.nvidia.com/object/win7-winvista-32bit-258.96-whql-driver.html

http://www.nvidia.com/object/win7-winvista-64bit-258.96-whql-driver.html

http://www.nvidia.com/object/notebook-win7-winvista-258.96-whql-driver.html

http://us.download.nvidia.com/Windows/258.96/258.96_notebook_win7_winvista_32bit_international_whql.exe

http://www.nvidia.com/object/notebook-win7-winvista-64bit-258.96-whql-driver.html

http://us.download.nvidia.com/Windows/258.96/258.96_notebook_win7_winvista_64bit_international_whql.exe
# Daniel on 2010-08-17 at 08:02
Well, it worked perfectly for me. Is ironic but the Internet Explorer 9 Test Drive page is a good for testing Hardware Acceleration:

http://ie.microsoft.com/testdrive/Default.html

Firefox 4 Beta 3 performs really well. It seems that the next generation of browsers will use this a lot, glad to see Mozilla going in this direction.

Now gotta play with this...
# D2DDW on 2010-08-24 at 18:24
Microsoft has released an update for Direct2D and DirectWrite, might help with the bugs.

http://support.microsoft.com/?kbid=2028560

Win7 32bit
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=b607f3ee-61ef-4069-97c6-d8a8b90b40a5

Win7 64bit
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=e04dd3bd-c34b-42ef-978b-10b73e7d5bba
July 2016
Mon Tue Wed Thu Fri Sat Sun
 << <   > >>
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Certain events have made me realise it's probably a good idea to have a 'blog' to share ideas and get feedback...

Search

XML Feeds

blogging software