[cairo] new gradient code and pixman/xserver optimizations

David Reveman davidr at novell.com
Thu Jan 5 05:56:32 PST 2006


On Wed, 2006-01-04 at 18:04 -0800, Carl Worth wrote:
> On Thu, 13 Oct 2005 12:02:22 -0400, David Reveman wrote:
> > During the gnome summit I did some work to make cairo use the gradient
> > code in pixman and xserver instead of the code currently in cairo.
> 
> Thanks for this work, David.
> 
> > I've attached a number of patches and a short description of them
> > follows. They are probably not ready for going into CVS yet as the fb
> > gradient code seam to produce slightly different results than the code
> > currently in cairo but it shouldn't take a big effort to fix that.
> 
> I assume that on closer inspection you decided that the results were
> close enough to be correct? (as you said in the following message). So
> you do consider all of this ready for CVS now, right?

yes, I believe it's ready for CVS.

> 
> I hope so, since...
> 
> > pixman-gradient-1.patch - Enables the gradient support in pixman.
> 
> This is in now.
> 
> > pixman-composite-general-fix-opt-1.patch - Some major performance
> > improvements to the general composite code used for gradients and
> 
> This one too.
> 
> > cairo-new-gradients-2.patch - Makes cairo use pixman for gradients.
> 
> This one is in except for the changes to cairo-glitz-surface.c which
> no longer apply cleanly, and it wasn't obvious to me how to
> fix. David, I assume you can handle this OK.

I've now updated the glitz and PDF backend. SVG backend needs to be
updated too, I'll probably do that later today.

> 
> > cairo-xlib-gradients-1.patch - Makes xlib backend use server-side
> > gradients when available. To work properly the next patch will have to
> > go into the server. There's a weird issue that is mysteriously worked
> > around with a call to XSync right now, see the comment in the patch for
> > more details on this. BTW, what's the rules for client-side libXrender
> > requirements? I just bumped the version requirement in configure.in for
> > now.
> 
> I have not looked at this one yet. I plan to do that tomorrow.

Use the attached patch instead. Gradient code in Xorg is currently
broken (crashes the server) so we don't want to use server-side
gradients on Xorg until we've fixed that. It will be fixed as we merge
the Xgl changes into Xorg. Once fixed, we'll update the xlib backend so
that on Xorg server versions with working gradient code server-side
gradients will be used.

> 
> > xserver-composite-general-fix-and-opt-1.patch - Basically the same as
> > pixman-composite-general-fix-opt-1.patch but for the server.
> 
> Nor this one. Is this going to be "hard" to merge after the recent
> code drop to xserver? Or did that code drop include this already?

This patch is important. It's already included in my code drop.

> 
> > Once all these patches land in CVS, gradient performance is going to be
> > significantly better.
> 
> Yes, I see about a 1.5x speedup to "svg2png gearflowers.svg" so that
> is encouraging.

Don't forget to look at the pixman-repeat-and-gradient-fixes-1.patch
that I attached to my second mail. It's also very important for better
performance and correctness.

> 
> >                    There's also some color table code for gradients
> > in pixman/xserver that is disabled now but can be enabled in some cases
> > for even better performance.
> 
> Is that "in some cases" because there are only limited conditions
> under which it gets the right answer? If so, what are those
> conditions?

If the color table will produce accurate results or not depend on how
high resolution it has between the color stops we're interpolating
between. e.g. if a gradient has 200 stops placed at equal distance from
each other, a color table of size 100 is used and when rendered it is
transformed so that color stop 50 hits the left side of the screen and
color stop 51 hits the right side of the screen. In this case the values
in the color table aren't very useful.

Thanks,

-David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-xlib-gradients-2.patch
Type: text/x-patch
Size: 9644 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060105/e8beb8d6/cairo-xlib-gradients-2.bin


More information about the cairo mailing list