[cairo] [Pixman] [PATCH] Added MIPS32R2 and MIPS DSP ASE optimized functions.

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Dec 8 06:07:06 PST 2010


On Thursday 02 December 2010 00:59:41 Georgi Beloev wrote:
> Please note -- the following Pixman patch has been updated to reflect
> comments received after an earlier submission. It was tested successfully
> on real hardware with Pixman 0.21.2.
> 
> 
> From 9ecf61f2072d8f51f845b086686380ff3c34f861 Mon Sep 17 00:00:00 2001
> From: Georgi Beloev <gb at beloev.net>
> Date: Wed, 1 Dec 2010 14:34:06 -0800
> Subject: [PATCH] Added MIPS32R2 and MIPS DSP ASE optimized functions.
> 
> The following functions were implemented for MIPS32R2:
>   - pixman_fill32()
>   - fast_composite_over_n_8_8888()
> 
> The following functions were implemented for MIPS DSP ASE:
>   - combine_over_u()
>   - fast_composite_over_n_8_8888()
> 
> Additionally, MIPS DSP ASE uses the MIPS32R2 pixman_fill32() function.
> 
> Use configure commands similar to the ones below to select the target
> processor and, correspondingly, the target instruction set:
> 
>   - MIPS32R2: configure CFLAGS='-march=24kc -O2'
>   - MIPS DSP ASE: configure CFLAGS='-march=24kec -O2'

Hi, thanks for the update.

Have you benchmarked these optimizations? Do you have some numbers to share?

When I tried to run some of the cairo-perf-trace benchmarks on my
AR7161, MIPS32 24Kc @680MHz device, I got the following results:

original:

[ # ]  backend                         test   min(s) median(s) stddev. count                                                                                                                                                                                                           
[ # ]    image: pixman 0.21.3                                                                                                                                                                                                                                                          
[  0]    image                      poppler  170.195  170.484   0.07%    6/6                                                                                                                                                                                                           
[  2]    image         gnome-system-monitor  383.189  383.368   0.02%    6/6                                                                                                                                                                                                           
[  3]    image                    evolution  155.689  155.737   0.01%    4/6

patched:

[ # ]  backend                         test   min(s) median(s) stddev. count
[ # ]    image: pixman 0.21.3
[  0]    image                      poppler  170.440  170.451   0.22%    3/3
[  2]    image         gnome-system-monitor  418.555  418.668   0.05%    3/3
[  3]    image                    evolution  162.266  162.390   0.04%    3/3

One of the reasons for such a slowdown in gnome-system-monitor test is that it
uses 'over_n_8_8888' operation with the mask where 96.5% of values are zero. 
And your MIPS32R2 optimized code does not handle these special cases, always
taking the slowest path [1].

I guess DSP ASE code should have much better performance, just because it needs
less instructions to do the job. Unfortunately I have no way to benchmark it
myself.

Anyway, I understand that it is hard to be one of the first developers to do
MIPS optimizations, considering that they are practically non-existent in open
source software currently. So the challenges are unavoidable. But preferably
the MIPS assembly code should improve pixman performance, and not just only
provide some kind of "MIPS optimized" check mark ;)

Regarding the runtime CPU capabilities detection, I think gcc actually has some
support for -march=native option on MIPS [2], and it is implemented by parsing
/proc/cpuinfo


1. http://lists.freedesktop.org/archives/pixman/2010-September/000498.html
2. http://gcc.gnu.org/onlinedocs/gcc-4.5.1/gcc/MIPS-Options.html

-- 
Best regards,
Siarhei Siamashka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.cairographics.org/archives/cairo/attachments/20101208/c08b986c/attachment.pgp>


More information about the cairo mailing list