[Xorg] MMX speedup

sandmann@redhat.com Soeren.Sandmann at daimi.au.dk
Fri Jul 2 13:55:35 PDT 2004


Attached is a patch that speeds up some operations in the Render
extension by using gcc 3.4 MMX intrinsics. A benchmark rendering a
paragraph of component alpha text to a pixmap gave these results on a
1200 MHz laptop with an i830 chip running Fedora Core I:

Unmodified X server and the pixmap in system RAM:

        [ssp at localhost x]$ ./a.out
        total time: 41.394618
        average rect time: 0.683200
        worst rect: 9
        average glyph time: 3.550500

with the MMX optimizations:

        [ssp at localhost x]$ ./a.out
        total time: 22.972553
        average rect time: 0.677900
        worst rect: 9
        average glyph time: 1.692000

Ie., text rendering is more than twice as fast. The patch includes
improved code for these cases:

Subpixel text:
- (constant color) in (component alpha mask) over 565 destination
- (constant color) in (component alpha mask) over 32bit destination
- (32 bit component alpha) Saturate (32 bit destination)

Regular antialiased text:
- (8 bit alpha) Saturate (8 bit destination)
- (constant color) in (8 bit alpha mask) over 565 destination
- (constant color) in (8 bit alpha mask) over 32bit destination

GdkPixbuf:
- (reversed, non-premultiplied source) over 32bit destination
- (reversed, non-premultiplied source) over 565 destination

Alpha rectangle (e.g., Nautilus selection rectangle):
- (constant color) over 32bit destination
- (constant color) over 565 destination

Solid fill
- solid fill of 32 bit drawable
- solid fill of 16 bit drawable

The code can optionally be compiled to use the pshufw instruction, which
is only available on pentium III. 

The patch has a bad hack where it redefines DefaultCCOptions for all of 
the framebuffer code. This is clearly not the best way to do it, but I'm
not sure how it could be done otherwise.


Soeren


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmx.patch
Type: text/x-patch
Size: 15579 bytes
Desc: The patch
URL: <http://lists.x.org/archives/xorg/attachments/20040702/b927afea/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fbmmx.c
Type: application/octet-stream
Size: 31893 bytes
Desc: fbmmx.c
URL: <http://lists.x.org/archives/xorg/attachments/20040702/b927afea/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fbmmx.h
Type: application/octet-stream
Size: 4796 bytes
Desc: fbmmx.h
URL: <http://lists.x.org/archives/xorg/attachments/20040702/b927afea/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: render-benchmark.c
Type: application/octet-stream
Size: 5340 bytes
Desc: The benchmark
URL: <http://lists.x.org/archives/xorg/attachments/20040702/b927afea/attachment-0002.obj>


More information about the xorg mailing list