[Pixman] fast-scale branch performance improvements

Alexander Larsson alexl at redhat.com
Tue Mar 16 06:07:13 PDT 2010


On Tue, 2010-03-16 at 13:26 +0100, Soeren Sandmann wrote:
> Hi,
> 
> > On Mon, 2010-03-15 at 03:25 +0200, Siarhei Siamashka wrote:
> > 
> > > But before it gets committed, some problems with potential fixed
> point
> > > overflows when dealing with large images need to be addressed. I
> have
> > > made a test program which can expose some of these problems:
> > >
> http://cgit.freedesktop.org/~siamashka/pixman/log/?h=largescaling-test
> > 
> > I pushed a new version of my branch, rebased on:
> > http://cgit.freedesktop.org/~sandmann/pixman/log/?h=alex-scaler
> > on (as before):
> > http://cgit.freedesktop.org/~alexl/pixman/log/?h=alex-scaler
> 
> Some comments:
> 
> * The warnings that Siarhei mentioned out are because this macro:
> 
>         #define CONVERT_0565_TO_8888(s) (CONVERT_0565_TO_0888(s) |
> 0xff0000000)
> 
>   has an extra zero in 0xff0000000. However, fixing this is not enough
>   to get scaling-test to pass.

Both the issues he pointed out are fixed in my branch. See other mails.

> * This chunk:
> 
>         if (unit_x >= 0)
>             while ...
>         else
>             while ...
> 
>   is repeated multiple times.
> 
>   Would it be possible to simply call the existing 'repeat' inline,
>   possibly extended with a 'unit' parameter?  If it is, then it seems
>   like all the repeat modes could be supported fairly easily and the
>   existing fast_composite_scale_nearest() could go away.

I'm not sure about the performance advantages here, but the if is to
handle the case that if we increase vx then we can avoid the check for
vx going < 0. So, the two possible versions are:

if (unit_x >= 0) 
    while (vx >= max_vx) vx -= max_vx;
else
    while (vx < 0) vx += max_vx;

vs:

while (vx >= max_vx) vx -= max_vx; else
while (vx < 0) vx += max_vx;

This later is what repeat() would expand to. It unnecessarily makes the
vx < 0 comparison, but avoids the unit_x comparison. unit_x is constant
over the whole function, so it might be cheaper. On the other hand it
probably doesn't matter much.

I'll try with using repeat.

For the rest, do you want incremental patches or a clean series?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a genetically engineered albino cowboy haunted by memories of 'Nam. She's 
a ditzy mute Valkyrie trying to make a difference in a man's world. They fight 
crime! 



More information about the Pixman mailing list