Thursday, September 06, 2012

Azure canvas on by default

As of tonight, Azure canvas is on by default on all platforms! The last platform to get turned on was Linux, for which Anthony Jones did a lot of work on performance to bring Azure canvas up to par with Thebes, and exceed it in some cases. In the next cycle we will get to remove Thebes canvas from the code-base altogether.

The flavour of Azure canvas you get depends on the platform: Firefox OS, Android, and Linux get Cairo, Mac gets Quartz, and Windows gets Direct2D, if you have Vista or 7, and your drivers are up to date, and your graphics card is not blacklisted; otherwise you get Cairo.

You can see which Azure backend you are getting for Canvas (and possibly content) in about:support. You can also see the fallback backend, this is used if for some reason the preferred backend cannot be used, usually for very large canvases which are larger than the maximum texture size for Direct2D.

You can change the canvas settings in about:config: gfx.canvas.azure.enabled should be true, you can force Thebes canvas by setting it to false (for now). gfx.canvas.azure.backends contains an ordered list of backend names, for example, "direct2d, skia, cairo". Your preferred backend is the first backend in that list which your platform supports. Your fallback backend is the first backend on that list which your platform supports, is not the preferred backend, and is Cairo (which means you might not have a fallback backend).

10 comments:

Anonymous said...

Windows XP when?

Running the latest Nvidia 301.24 drivers and will update to the latest Nvidia 306.xx drivers when released next week or later this month.

Jesse Ruderman said...

What happens if Cairo isn't in your gfx.canvas.azure.backends list, and you encounter a large canvas?

Nick Cameron. said...

Anonymous: if you are asking which backend you will get, then Cairo by default, you could also try Skia, but this is not yet a supported configuration (and may never be). If your drivers are up to date, you should get DirectX 9 layers, but that is separate from the Azure backend.

Nick Cameron. said...

Jesse: right now, it will fallback to Thebes canvas, in fact, if we can't use any backend in the preferred or fallback list, then we use Thebes canvas (so leaving backends blank has the same effect as setting enabled=false). We will have to decide what to do when we remove Thebes canvas.

njn said...

I'll be watching for any reports of large jumps in memory consumption. Please do likewise! :)

Anonymous said...

Isn't Skia here to replace Cairo in the long term since Cairo uses fixed-point arithmetics?

Dan said...

"The flavour of Azure canvas you get depends on the platform: Firefox OS, Android, and Linux get Cairo, Mac gets Quartz, and Windows gets Direct2D, if you have Vista or 7, and your drivers are up to date, and your graphics card is not blacklisted; otherwise you get Cairo."

So who gets Skia then?

Nick Cameron. said...

Anonymous: Skia might replace Cairo for some/all tasks, if the performance is better than Cairo. Currently we are getting mixed results - some things Cairo is better at, and some things Skia is. Skia seems to be developing more quickly at the moment. We need more (and better) data.

The use of fixed or floating point is only one element in a whole bunch of stuff that affects performance

Nick Cameron. said...

Dan: currently, nobody gets Skia by default. It has been tested on Windows and works there (but not if D2D is on, due to font issues). I think it has been tested on Android too, but not sure. We will switch to Skia if and when performance and stability is better on a given platform.

Anonymous said...

Skia is more correct than Cairo. Can be seen at this page. So please fix Skia.