[cairo] threaded, journaled software backend/rasterizer experiment

Øyvind Kolås pippin at gimp.org
Thu Sep 22 18:01:26 PDT 2011


I've implemented a tiled/queue based vector-rasterizer experiment to
explore rendering strategies and performance. The experiment can be
useful to learn from perhaps some of this code could even find use in
cairo.

The antialiasing quality strives to be equivalent to 15x17
supersampling. In addition to rasterizing bezier paths ◯ uses the
equivalent of fragment shaders to compute source patterns like solid
colors, linear and radialgradients and surface sources. (invert,
brightness contrast, blurs and more could be implemented as more such
shaders.) At the moment the code has to choose a pixel format to
target, changing this to be 16bit or floating point requires swapping
a couple of files.

The code to be used with it's own state management or use a cairo
surface as well as be driven from cairo, I wrote the code this started
from for a memory constrained environment where I wanted a cairo like
API.

All path building, and painting commands (with source state snapshots)
get journaled, when the scene is flushed (needs to be done if using
the cairo surface as if it was an image surface and doing mid-render
readbacks). Indexes for tiles are built up as the journal is written
and only paths intersecting a tile gets an index written. The optimal
tiles to render seem to be chunks of scanlines and not square
rectangles, to avoid having to process the same set of edges during an
active edge table rasterization pass. It is possible to store hashes
of the journals relevant paths per tile, and avoid rerendering if the
front buffer already contains the correct data, this is disabled by
default. II haven't quite worked out how to best to front to back
rendering for portions of the commands in the journal yet.

Core utilzation seems to be quite good when rendering, for a single
core rendering cairo's image backend with pixmans optimizations is
quite a bit faster, but that should be expected given its used of
SIMD.

The code is available at http://pippin.gimp.org/git/cairo/log/ the git
repository there provides both a cairo surface wrapping the rasterizer
and some tests that drive ◯ directly.

/Øyvind Kolås - Intel Open Source Technology Centre, London
--


More information about the cairo mailing list