[cairo] RSVG slow cairo rendering
chris at chris-wilson.co.uk
Fri Sep 20 12:36:14 PDT 2013
On Fri, Sep 20, 2013 at 03:54:08PM +0000, Louis Simons wrote:
> I’m pretty new to working with Cairo rendering, and apologize if this is
> the wrong forum.
> I’m prototype an embedded display using wxPython, Cairo, RSVG, and
> Inkscape (to generate SVGs). I’ve written a simple animator which lets me
> blink/fade/move etc. parts of the displayed image by adding transformer
> and css styles based on the SVG element’s ID. Unfortunately, when the
> component is drawn larger (for example, full-screen on a monitor vs.
> windowed in a form), the framerate decreases significantly. I’ve profiled
> the code, and the slowdown is in the
> rsvg.Handle(data=svg_xml_data).render_cairo(context_to_render_to) call.
The input SVG is a vector file format, the output display is a raster
image format. You are using librsvg+cairo to render the SVG paths onto
the display, performance of which will inversely scale with the number
of pixels being rendered (and the complexity of the input paths and
Cairo has two goals here, one to have a fast enough CPU renderer that
nobody notices, and two to optionally offload as much of the path
rendering to a GPU as is feasible. To enable GPU acceleration requires
the application to setup a cairo device and surface for the GPU - and
then it can treat the surface just like any other raster surface.
Chris Wilson, Intel Open Source Technology Centre
More information about the cairo