[cairo] Profiling the slowness of xlib surface

Vladimir Vukicevic vladimirv at gmail.com
Thu Apr 20 10:50:38 PDT 2006


You can see some more results with the cairo-bench program that I put
together, described in
http://lists.freedesktop.org/archives/cairo/2006-March/006547.html . 
There are some significant performance hits if you mix an image
surface with an xlib surface -- every time you draw to the xlib
surface, a temporary xlib surface is created and your image data gets
loaded into it.  To compound this, I've heard that the X drivers often
allocate pixmaps in video memory; however nearly all of the current
Render calls are done in software through pixman on the server side,
so for every operation the data needs to be read back into main
memory, operated on, and then put back into video memory.  This is
still the case even with two xlib surfaces.  This basically means that
if you're running under X, in many cases you're better off doing as
much as you can in a local image surface, and only blitting the final
result to X.

    - Vlad

On 4/20/06, Timothée Lecomte <timothee.lecomte at ens.fr> wrote:
> Hi all !
>
> For my gnuplot terminal based on Cairo, I use a temporary surface where I
> draw thousands of adjacent polygons with CAIRO_OPERATOR_SATURATE, and then
> I use the result as a source pattern to paint the main context.
>
> This process works quite well with both image surfaces, but is somewhat slow.
>
> But it is even worse if my main surface is a xlib surface, obtained by
> gtk_cairo_create(my_offscreen_pixmap).
>
> If I create my temporary surface with cairo_surface_create_similar(), I
> get the artifacts as reported in a previous post (thread "avoiding
> seams").
> If I create the temporary surface with cairo_image_surface_create(), the
> output is correct.
> In both cases, the process is twice as slow compaired to the pure 'image
> surface' case.
>
> To track the slowness, I used sysprof to make a profile of the system calls.
> I use xorg 6.9, on a radeon, without the composite extension, and without
> EXA.
>
> Here are the results :
> * final and temporary image surface : 55% of the time spent on fbCopyAreammx
> * final xlib surface, temporary image surface : idem
> * final and temporary xlib surface : 46 % of the time spent on
> fbCompositeSrc_8888x8888mmx
>
> You can find the sysprof profiles here (you can open them in sysprof to
> see the tree of calls) :
> http://tipote.free.fr/profile_image_image
> http://tipote.free.fr/profile_xlib_image
> http://tipote.free.fr/profile_xlib_xlib
>
> I don't know if something can be done, but it is somewhat discouraging to
> see that a pure image surface is faster than a xlib one. Does it mean that
> pixman uses X to render ?
> Can I do something to improve this situation ?
>
> Thanks for your help, and for the great work done on Cairo.
>
> Regards,
>
> Timothée Lecomte
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
>


More information about the cairo mailing list