[cairo] Using cairo/pixman for raw video in GStreamer

Soeren Sandmann sandmann at daimi.au.dk
Thu Sep 24 11:58:13 PDT 2009


Bill Spitzak <spitzak at gmail.com> writes:

> In general I consider tiled apis to make things unnecessarily
> complicated. The majority of cairo input is packed into an array. You
> either need to require images to be padded out to a multiple of tile
> size, or you need to greatly complicate things with "partial tiles"
> with whatever code is needed to avoid ever addressing the non-existent
> parts of the tiles.

What I'm proposing is not to actually *store* the images in tiles, but
simply to *access* them in a tiled pattern. So I'm not proposing any
externally visible tiled *API* for now. (Though I think support
for tiled storage may also be interesting for various reasons).

> > Aside from hopefully solving the subsampling problem, tiles would also
> > have better cache behavior for rotated or filtered sources.
> 
> No the performance is TERRIBLE for filters. A filter near the edge of
> a tile will require an entire neighboring tile. In scanlines the
> filter always gets only the exact input scanlines needed.

Consider processing an image with a 9x9 filter kernel. If you process
it on a scanline by scanline basis, you will need to keep 9 scanlines
in flight at the same time. This is more than will typically fit in
L1, so if the cache replacement policy is Least Recently Used, then
each processed cacheline will cause nine cache misses. So processing
32 scanlines of 64 cache lines causes 32 * 64 * 9 = 18432 cache
misses.

On the other hand processing 32 tiles of 32x32 pixels causes a total
of 32 tiles times 32 + 8 rows times 2 cachelines = 2560 misses.

> Tiles do help for rotation of giant images, and for drawing a section
> out of the center of an image. But neither of these are common
> operations for Cairo, which really wants to draw images that are
> smaller than the screen fast.

I don't see why tiles don't help for small rotations too. Cache lines
are pretty small.


Soren


More information about the xorg-devel mailing list