Direct2D/DirectWrite Accelerated Rendering For Firefox

Discussion about official Mozilla Firefox builds
Locked
User avatar
Omega X
Posts: 8225
Joined: October 18th, 2007, 2:38 pm
Location: A Parallel Dimension...

Direct2D/DirectWrite Accelerated Rendering For Firefox

Post by Omega X »

Now that this has officially released in Firefox 4, its time to revise the first post.

Things to Know BEFORE Activation:

1. Direct2D and DirectWrite is ONLY available on Windows 7/Windows Server 2008/Windows Vista SP2(With Platform Update)
2. Some Add-ons may interfere with proper operation when they call a certain API prematurely.
3. Your Video Drivers should be updated to the latest version.

How to Turn on Direct2D & DirectWrite for Windows 7/Windows Server 2008/Windows Vista SP2(With Platform Update):

Direct2D & DirectWrite should be on by default for compatible systems. The Option to toggle Accelerated Rendering on or off is in the "Advanced" section of the "General" Tab in the Options Window.

To turn it On or OFF:

Open up the Options Dialog: Firefox Menu > Options (Classic Menu: Tools > Options)

Select: Advanced > "General" Tab > "Use hardware acceleration when available"

If successful, the fonts on the page and browser should be smoother. Websites with large images should load faster. SVG examples should be much faster. CSS3 and Javascript manipulations should animate quicker.

To Check for Direct2D/DirectWrite working on your system:
Firefox Menu > Help > Troubleshooting Information

- At the bottom of the page Both Direct2D and DirectWrite should say "true".
- GPU Accelerated Windows category should say "1/1 Direct3D 10".


Forcing Acceleration ON

WARNING!

This is NOT recommended. The developers have disabled acceleration in Firefox on your system for stability reasons.

TO FORCE ON:
In about:config, Search for "gfx.direct2d.force-enabled".
- If its not there then add it. (Right Click anywhere and select "NEW" then "boolean". Add in the pref without quotes.)
- Double Click the pref to turn it "true". That will enable Direct2d & DirectWrite. To revert, double click again.

Known Issues:

- Some fonts do not render properly depending on a few factors including Video Card, drivers and ClearType settings.
- Memory Usage will increase slightly. (But not noticeably high.)
- Enabling Anti Aliasing with Firefox on Nvidia Graphics Drivers will cause graphics corruption.
- Enabling Anisotropic Filtering with Firefox can cause fonts to blur.

Filing Bugs:

If you would like to file bugs for this issue, be sure to search for the bug first.
The Dependency List can also show what issues are already linked.

If the bug is not filed then Open a New bug, attach [DW] for Text rendering oddities or [D2D] for other graphical errors to the title of the bug with "Core:Graphics" as the component and "Trunk" as the version and give them detailed information on the problem including Graphics Hardware and Driver Version.

Frequently Asked Questions:

1. Why Direct2D and DirectWrite and not DirectX10?
- Direct2D and DirectWrite are new solutions to replace GDI/GDI+ in current and future versions of Windows. These new solutions run ontop of DirectX10.

2. Why not OpenGL?
- Direct2D and DirectWrite has advantages that the standard OpenGL API in Windows currently does not.

3. What is the Windows Vista Platform Update?
- Microsoft created an update to backport some Windows 7 core functions to Windows Vista. Windows Vista users should have already received and installed this package through Windows Update.

4. Will My DirectX9 Hardware work?
- Yes, providing you are using Windows 7 or Windows Vista SP2 (With Platform Update). In those Operating Systems, some DirectX10 functions are emulated for DirectX9 hardware which is called "DirectX10-Level-9". There is a chance that some older DirectX9 cards won't work.

5. Why is Windows Xp not Supported?
- Direct2D and DirectWrite requires DirectX10. DirectX10 can only be found on Windows 7/Windows Server 2008/Windows Vista SP2(With Platform Update).


Examples to Test:

http://maps.google.com (the maps, not street view.)
http://demos.hacks.mozilla.org/openweb/HWACCEL/
http://people.mozilla.org/~jdaggett/tes ... rfall.html
http://people.mozilla.com/~vladimir/demos/photos.svg
http://srufaculty.sru.edu/david.dailey/svg/balloon.svg
http://srufaculty.sru.edu/david.dailey/ ... drag12.svg
http://www.tapper-ware.net/stable/web.d ... transform/
http://mrdoob.com/projects/chromeexperiments/ball_pool/
http://ie.microsoft.com/testdrive/Default.html
http://demos.hacks.mozilla.org/openweb/WARMCSS/
http://demos.hacks.mozilla.org/openweb/LONDONPROJECT/
http://demos.hacks.mozilla.org/openweb/CSSMAKESUSICK/


More Information:

http://www.basschouten.com/blog1.php/20 ... -a-browser
http://www.basschouten.com/blog1.php/20 ... irectwrite
http://en.wikipedia.org/wiki/Direct2D
http://en.wikipedia.org/wiki/DirectWrite
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
http://blogs.msdn.com/directx/archive/2 ... write.aspx
http://blogs.msdn.com/directx/archive/2 ... d-gdi.aspx
http://blogs.technet.com/thomasolsen/ar ... d-api.aspx
Last edited by Omega X on April 23rd, 2011, 8:54 pm, edited 42 times in total.
NJKR
Posts: 249
Joined: June 29th, 2006, 8:34 am
Location: NJ, USA

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by NJKR »

Thanks :)
User avatar
a;skdjfajf;ak
Posts: 17002
Joined: July 10th, 2004, 8:44 am

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by a;skdjfajf;ak »

Another good test link that really shows off the performance with DirectWrite and D2D enabled:

http://srufaculty.sru.edu/david.dailey/svg/balloon.svg

If you want to turn off the D2D and do no want to remove/add the pref for the widget, you can set to value to '0' (zero) and it will for normal GDI (browser restart is required)
Crooked Rain
Posts: 71
Joined: July 21st, 2004, 4:47 pm

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by Crooked Rain »

Looks good. Nice job.

You might want to mention downloading the latest development version of Adblock Plus for D2D/DW compatibility since it is probably the most widely used extension. It can be found here:
https://adblockplus.org/devbuilds/adblockplus/

This is another good test example that was mentioned in another thread:
http://srufaculty.sru.edu/david.dailey/svg/balloon.svg

This test provided the biggest noticeable difference to me after enabling D2D/DW.
User avatar
_Dexter_
Posts: 1436
Joined: August 30th, 2008, 6:54 pm
Location: Miami

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by _Dexter_ »

Scrolling at times will become sluggish but usually returns to normal in the course of viewing other pages.
Intel i7 Core Quad @ 4.25Ghz | Cooler Master Hyper 212 Plus | 12GB PC3-16000 RAM | ASUS HD6970 2GB - 12.3 CATS | ASUS PA246Q IPS 24" LCD 16:10 | OCZ AGILITY-EX SSD SLC | Windows 7 SP1 x64 Ultimate
User avatar
Omega X
Posts: 8225
Joined: October 18th, 2007, 2:38 pm
Location: A Parallel Dimension...

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by Omega X »

I forgot about that balloon example, and I went looking for it twice. :p
User avatar
squall_leonhart
Posts: 885
Joined: March 17th, 2008, 5:32 am
Location: Australia
Contact:

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by squall_leonhart »

- OpenGL has minimal support in Windows. Direct2D and DirectWrite are native solutions.


Incorrect.

OpenGL has fantastic support on windows, its the vendors who produce the drivers that suck at supporting it, and if its not supported properly on windows you'd be hard pressed finding it supported on linux either (ATI and Intel as examples).

- Memory Usage will increase slightly. This is most likely due to using Video Ram.

Its not. VRAM usage has not increased at all using D2D.
Capn Refsmmat
Posts: 170
Joined: October 8th, 2004, 2:26 pm
Contact:

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by Capn Refsmmat »

Are there, in fact, plans to enable OpenGL on platforms other than Windows?
User avatar
Omega X
Posts: 8225
Joined: October 18th, 2007, 2:38 pm
Location: A Parallel Dimension...

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by Omega X »

squall_leonhart wrote:
- OpenGL has minimal support in Windows. Direct2D and DirectWrite are native solutions.


Incorrect.

OpenGL has fantastic support on windows, its the vendors who produce the drivers that suck at supporting it, and if its not supported properly on windows you'd be hard pressed finding it supported on linux either (ATI and Intel as examples).

- Memory Usage will increase slightly. This is most likely due to using Video Ram.

Its not. VRAM usage has not increased at all using D2D.



Microsoft gives minimal OpenGL support on Windows. Its no surprise that Driver makers don't support it properly there since they have to do most of the work.

Also, some have reported increased memory usage after turning on D2D and DW. I made a guess as to what was happening. If you have hard evidence please share it.


@ Capn Refsmmat

Yes, there were mentions of plans to enable OpenGL support for OSX and Linux.
Capn Refsmmat
Posts: 170
Joined: October 8th, 2004, 2:26 pm
Contact:

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by Capn Refsmmat »

Nifty. I searched for bugs filed on OpenGL, but this is all I found:

https://bugzilla.mozilla.org/show_bug.cgi?id=opengl

and there hasn't been much activity for a while. But if they do intend to, this should be interesting...
User avatar
squall_leonhart
Posts: 885
Joined: March 17th, 2008, 5:32 am
Location: Australia
Contact:

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by squall_leonhart »

Omega X wrote:
squall_leonhart wrote:
- OpenGL has minimal support in Windows. Direct2D and DirectWrite are native solutions.


Incorrect.

OpenGL has fantastic support on windows, its the vendors who produce the drivers that suck at supporting it, and if its not supported properly on windows you'd be hard pressed finding it supported on linux either (ATI and Intel as examples).

- Memory Usage will increase slightly. This is most likely due to using Video Ram.

Its not. VRAM usage has not increased at all using D2D.



Microsoft gives minimal OpenGL support on Windows. Its no surprise that Driver makers don't support it properly there since they have to do most of the work.


All graphic card vendors provide a minimal of OpenGL 1.4 ICD. Intel's and ATI's opengl on linux is near non existant (and the open source drivers are a mockery).

Also, some have reported increased memory usage after turning on D2D and DW. I made a guess as to what was happening. If you have hard evidence please share it.


System memory yes, not video memory. Only Nvidia cards can display the usage of Video memory via NVAPI and it has not increased at all through using Direct2D.
User avatar
Omega X
Posts: 8225
Joined: October 18th, 2007, 2:38 pm
Location: A Parallel Dimension...

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by Omega X »

Capn Refsmmat wrote:Nifty. I searched for bugs filed on OpenGL, but this is all I found:

https://bugzilla.mozilla.org/show_bug.cgi?id=opengl

and there hasn't been much activity for a while. But if they do intend to, this should be interesting...



Yeah, Bas has been preoccupied with D2D and Layers. The plan I saw was to merge Cairo's latest OpenGL work to the Trunk and adjust it. But there were import issues to be worked out before hand.

Also see this:
https://bugzilla.mozilla.org/show_bug.cgi?id=546517
https://wiki.mozilla.org/Gecko:Layers


@Squall

Thanks, I'll remove that guess on VRam.
User avatar
smsmith
Moderator
Posts: 19979
Joined: December 7th, 2004, 8:51 pm
Location: Indiana

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by smsmith »

Stickied. Please let me know when it's importance is through.
Give a man a fish, and he eats for a day. Teach a man to fish, and he eats for a lifetime.
I like poetry, long walks on the beach and poking dead things with a stick.
Please do not PM me for personal support. Keep posts here in the Forums instead and we all learn.
User avatar
Omega X
Posts: 8225
Joined: October 18th, 2007, 2:38 pm
Location: A Parallel Dimension...

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by Omega X »

Thanks! Sure thing.
supernova_00
Posts: 4832
Joined: June 24th, 2004, 8:03 pm
Location: Maryland, USA

Re: Direct2D & DirectWrite HW Acceleration For Minefield - Info

Post by supernova_00 »

Omega X: I suggest you add the dependency tree so a bunch of dupes are not filed and to also suggest users mark any bugs dependent on bug 527707.

https://bugzilla.mozilla.org/showdepend ... resolved=1
Locked