Why is HWACCEL slow on my computer?

There’s a pretty impressive demo called HWACCEL which is quite slow on computers that are ostensibly hardware accelerated. To understand why, you need to understand a little bit about how HWACCEL is built.

A little bit about HWACCEL

HWACCEL creates a big HTML5 canvas, then uses the canvas drawImage function to draw lots of images.

Why is canvas slow on hardware accelerated computers?

Canvas is a general drawing API. Hardware accelerating general drawing APIs is quite hard; Microsoft wrote a framework called Direct2D that uses your DirectX 10 hardware to hardware accelerate a lot of different things, and we use this framework where it’s available (Windows Vista and 7). It doesn’t exist anywhere else, though, so we can only use the somewhat more limited 3D functionality provided by frameworks like Direct3D and OpenGL on Windows XP and Mac OS X. (For more information on the difference, see my previous blog post on how we are going to hardware accelerate Firefox 4.)

So canvas is always going to be slow, then?

Not if we can help it! Writing a hardware accelerated backend to canvas is tough, but it’s doable. We might try to use Cairo’s OpenGL backend. We also might try collaborating with some of the other browser maker. As I’m sure it’s clear, we haven’t quite worked out what the path to success will be, just that we need one.

When’s all this going to happen?

Later. Not for Firefox 4, for sure; with some hard work and a little bit of luck, we might have something for 4.next. We welcome folks helping us out – right now, that means helping us fix the Graphics bugs blocking us from releasing Firefox 4. Join us on Mozilla IRC, channel #gfx, if you’re interested!


  1. So to be clear, IE would also be slow on the same hardware, right? (Since it too would not have Direct2D to use.)

    • Well, it’s sort of complicated. The only version of IE that supports canvas is IE9, which has a hard dependency on Direct2D. So IE9 only runs on Windows Vista and 7, where Direct2D is available. But, were they to implement canvas on non-D2D platforms, yes, it’d be slow.

  2. I wrote this test.

    Yes, it shows Content Acceleration, not Compositing.

    It’s fast if D2D or XRender are used:
    Windows Vista/7 or Linux with a good driver (intel & NVidia)

    Question: is it possible to “measure” compositing acceleration (OpenGL)?

  3. Compositing acceleration could be measured by using only HTML image elements (instead of using a canvas); it’s possible for us to accelerate that using the layers system, but canvas is impossible.

  4. Artem S. Tashkinov

    Do 58FPS on 1600×1200 screen mean I have everything properly accelerated?

    Cause that’s exactly how much I get on Linux/Fedora14/Intel i5GPU.

  5. Mozilla should work with Khronos and Nvidia to define a good OpenGL 2D API that can deliver all the GPU hardware acceleration capabilities of Direct2D on XP SP3 and Linux.


  6. Is it possible to implement an OpenGL ES accelerated HTML Canvas 2D?…

    Like IE9, Firefox 4 will use Direct2D to accelerate canvas on systems that support Direct2D (Vista and 7 with modern graphics chips). Mozilla’s Joe Drew had this to say about a possible OpenGL backend: “Writing a hardware accelerated backend to canva…

  7. The overall impression is a much more lightweight browser than Firefox 3.6. Mozilla has made clever use of the available space and while we know that design is always a matter of taste, we believe that Firefox 4 arrives with a modern, attractive and somewhat unique interface. Firefox 4 carries a massive task on its shoulders, a task to retake lost market share, defend a very competitive new rival, IE9 and build a bridge to Mozilla’s future, which will be represented much more by Firefox 5 than by Firefox 4. Firefox 5 is due before July of this year.

Leave a Reply

Your email address will not be published. Required fields are marked *