Bernardo Innocenti wrote:
> This patch is likely to make a big difference in the EXA codepath
> I benchmarked, which is heavily used by the OLPC GTK theme.
>
> The mini-benchmark attached to #1837 mimics it by drawing rounded
> edges shapes with Cairo.
> [...]
> -------- Original Message --------
> Subject: [PATCH] Avoid an unwanted pixmap migration in EXA when
> compositing trapezoids
> Date: Wed, 15 Aug 2007 19:58:56 +0200
> From: Fredrik Höglund <[EMAIL PROTECTED]>

I made quite some testing with the attached benchmark: I tried with a few
different configurations (24 and 16 bit display, different snapshots of
xserver 1.4): speed increase is consistently at 30%.
Definitely not bad, and the patch is already committed in the server-1.4-branch.
Looking at oprofile output is evident that the main optimization is avoiding
memcpy'ing the pixmaps.

Benchmark result without the patch (16 bpp):
  op: rect
user: 2.600
 sys: 0.050
real: 7.930
op/s: 126.103

Oprofile report:

  samples|      %|
------------------
      534 56.8085 Xorg
                  TIMER:0|
          samples|      %|
        ------------------
              243 45.5056 libc-2.6.so
              211 39.5131 libpixman-1.so.0.9.4
               38  7.1161 amd_drv.so
               17  3.1835 libexa.so
               16  2.9963 Xorg
                8  1.4981 libfb.so
                1  0.1873 libextmod.so
        [...]

samples  %        linenr info                 image name               app name 
     symbol name
225      23.9362  (no location information)   libc-2.6.so              Xorg     
     memcpy
213      22.6596  (no location information)   libcairo.so.2.11.5       python   
     (no symbols)
168      17.8723  pixman-edge.c:322           libpixman-1.so.0.9.4     Xorg     
     pixman_rasterize_edges
63        6.7021  (no location information)   no-vmlinux               
no-vmlinux    (no symbols)
56        5.9574  (no location information)   libpython2.5.so.1.0      python   
     (no symbols)
19        2.0213  cim_gp.c:3305               amd_drv.so               Xorg     
     gp_wait_until_idle
16        1.7021  (no location information)   libc-2.6.so              python   
     msort_with_tmp
12        1.2766  pixman-mmx.c:0              libpixman-1.so.0.9.4     Xorg     
     __divdi3
11        1.1702  cim_gp.c:1228               amd_drv.so               Xorg     
     gp_color_bitmap_to_screen_blt


** With the patch applied:

  op: rect
user: 2.550
 sys: 0.020
real: 6.070
op/s: 164.745

  samples|      %|
------------------
      709 47.1096 Xorg
                  TIMER:0|
          samples|      %|
        ------------------
              511 72.0733 libpixman-1.so.0.9.4
               71 10.0141 amd_drv.so
               43  6.0649 Xorg
               40  5.6417 libexa.so
               36  5.0776 libc-2.6.so
                7  0.9873 libfb.so
                1  0.1410 librt-2.6.so
        [...]

samples  %      linenr info                 image name               app name   
  symbol name
407    27.0432  (no location information)   libcairo.so.2.11.5       python     
  (no symbols)
322    21.3953  pixman-edge.c:322           libpixman-1.so.0.9.4     Xorg       
  pixman_rasterize_edges
130     8.6379  (no location information)   no-vmlinux               no-vmlinux 
  (no symbols)
103     6.8439  (no location information)   libpython2.5.so.1.0      python     
  (no symbols)
90      5.9801  pixman-utils.c:165          libpixman-1.so.0.9.4     Xorg       
  pixman_fill
40      2.6578  (no location information)   libc-2.6.so              python     
  msort_with_tmp
32      2.1262  cim_gp.c:1228               amd_drv.so               Xorg       
  gp_color_bitmap_to_screen_blt
#!/usr/bin/python
from __future__ import division
import __main__
import cairo
import gtk
import math
import os

NFRAMES = 1000
WIDTH = 150
HEIGHT = 50 

def result(name, start, end):
    elapsed_user = end[0] - start[0]
    elapsed_sys  = end[1] - start[1]
    elapsed_real = end[4] - start[4]

    print "  op: %s" % name
    print "user: %.3f" % elapsed_user
    print " sys: %.3f" % elapsed_sys
    print "real: %.3f" % elapsed_real
    print "op/s: %.3f" % (NFRAMES / elapsed_real)

def bench(op, drawarea):
    cr = drawingarea.window.cairo_create()
    start = os.times()
    for i in range(0, NFRAMES):
        op(cr, i)
    end = os.times()
    result(op.__name__, start, end)

def arc(cr, frame):
    cr.set_source_rgb(frame % 2, (frame // 2) % 2, (frame // 3) % 2)
    cr.arc(150 + frame / 500, 150, 50 + (frame / 10), 0, 2 * math.pi)
    cr.fill()

def rect(cr, frame):
    cr.set_source_rgb(frame % 2, (frame // 2) % 2, (frame // 3) % 2)
    cr.arc(150 + frame / 500, 150, 50 + (frame / 10), 0, 2 * math.pi)
    cr.fill()

def rounded_rect(cr, frame):
    cr.set_source_rgb(frame % 2, (frame // 2) % 2, (frame // 3) % 2)
    cr.arc(WIDTH - 20, 20, 20, - math.pi / 2, 0);
    cr.arc(WIDTH - 20, HEIGHT - 20, 20, 0, math.pi / 2);
    cr.arc(20, HEIGHT - 20, 20, math.pi / 2, math.pi);
    cr.arc(20, 20, 20, - math.pi, - math.pi / 2);
    cr.close_path()
    cr.fill()


win = gtk.Window()
drawingarea = gtk.DrawingArea()
win.add(drawingarea)
drawingarea.set_size_request(1200,900)
win.show_all()

bench(rect, drawingarea)

del win
_______________________________________________
Devel mailing list
[email protected]
http://lists.laptop.org/listinfo/devel

Reply via email to