[cairo] Re: Lander Game

Owen Taylor otaylor at redhat.com
Tue Jan 9 11:32:24 PST 2007


On Tue, 2007-01-09 at 19:33 +0100, Benjamin Otte wrote:
> On Tue, 9 Jan 2007, Owen Taylor wrote:
> 
> > On the other hand, there's no reason cairo shouldn't be fast enough
> > to do full-frame-rate rendering from scratch of most things. After all,
> > that's how 3D games work! While the stuff cairo is doing isn't going to
> > be as well matched by the hardware, there's a lot of cycles in 1/30th
> > of a second these days...
> >
> After hacking on swfdec and trying to render Flash movies with cairo, I
> can tell you that unless you use the full magic of OpenGL on dedicated
> hardware, what you can do in 1/30th of a second is very little.
> 
> If you try to render 320x200 pixels with 10 layers on recent hardware,
> you'll probably start to sweat already. I have no clue if you get to
> 30fps. But my 1GHz iBook will definitely not reach 10fps. 

My phrasing was perhaps unclear. I didn't mean that cairo *is* fast
enough, but that the hardware is plenty fast enough and more to make
cairo that fast.

> As of cairo 1.3 this is no longer a tesselation issue, but the fact that alpha
> compositing in the X server will eat your cycles. With cairo 1.2 you will
> not even reach 5fps as your time is spent tesselating. That's at least
> from my benchmarks a few weeks ago (cairo 1.3.8, so i.e. the long lines
> issue was still present, no clue how much that influenced the result).

So how much are you compositing? 320x200x10x30 = 19M pixels. 

(If you actually have to alpha composite all the pixels in all the
layers, which is quite unlikely... most likely most of the pixels in
most of the layers have alpha values of 0 or 255.)

I haven't done much testing on PPC machines, but I suspect that 19M
pixels/sec is doable in plain C on your computer. Throw in Altivec
you'd blow that away. Throw in even the most basic hardware
acceleration...

You are likely hitting one or both of two things:

 - The plain C code paths in software compositing in the X server
   haven't gotten much work: the general approach to seeing bottlenecks
   in fbCompositeGeneral has been to add the necessary
   fast-paths to fbmmx.c.

 - The standard X server is still doing a horrid job of memory
   management, and you may well be doing software compositing 
   from and to video memory.

					- Owen




More information about the cairo mailing list