[cairo] XShm, again

Chris Wilson chris at chris-wilson.co.uk
Fri Aug 15 23:51:08 PDT 2008


Hi all,
I've been playing around with the basic xshm patch again and I'm still
seeing disappointing results. In short, it appears to consistently slow
down text. This is just the basic patch to enable _get_image_surface()
and _draw_image_surface() to use XShm, and it is highly likely that the
thresholds could be tweaked etc. However, I expect better results if we
can reduce the frequency of GetImage/PutImage altogether - I think
Behdad has been thinking along similar lines.

Please take a look at the patch and see if any obvious stupidity leaps
out.

Perf results:
i915GM, 600Mhz Celeron
Speedups
========
 xlib-rgba&             tessellate-256-100  101.81 0.64% ->  87.60
1.90%:  1.17x speedup
▏
 xlib-rgba  zrusin_another_tessellate-415   25.08 0.42% ->  22.63 0.52%:
1.11x speedup
▏
 xlib-rgb  paint_image_rgba_mag_source-256    2.63 0.88% ->   2.37
0.82%:  1.11x speedup
▏
 xlib-rgba     paint_solid_rgb_source-256    0.78 2.30% ->   0.71 0.58%:
1.10x speedup
▏
 xlib-rgb   paint_image_rgba_mag_over-256    2.62 1.13% ->   2.36 0.96%:
1.10x speedup
▏
 xlib-rgb&    paint_image_rgba_source-256    4.45 0.21% ->   4.03 0.15%:
1.10x speedup
▏
 xlib-rgba    paint_solid_rgba_source-256    0.73 0.56% ->   0.66 2.64%:
1.10x speedup
▏
 xlib-rgb&     paint_solid_rgb_source-256    0.78 0.44% ->   0.71 0.30%:
1.10x speedup
▏
 xlib-rgb     paint_solid_rgba_source-256    0.71 0.53% ->   0.65 0.54%:
1.10x speedup
▏
 xlib-rgba&     paint_image_rgb_source-256    4.78 0.48% ->   4.66
3.79%:  1.10x speedup
▏
 xlib-rgba&    paint_solid_rgba_source-256    0.73 3.04% ->   0.66
0.47%:  1.10x speedup
▏
 xlib-rgba     paint_image_rgb_source-256    4.88 0.40% ->   4.46 0.40%:
1.10x speedup
▏
 xlib-rgb&     paint_image_rgb_source-256    4.46 0.26% ->   4.07 0.26%:
1.10x speedup
▏
 xlib-rgba&       paint_image_rgb_over-256    4.80 0.54% ->   4.37
0.43%:  1.09x speedup
▏
 xlib-rgba       paint_image_rgb_over-256    4.84 1.52% ->   4.42 0.48%:
1.09x speedup
▏
 xlib-rgb&      paint_image_rgba_over-256    4.86 0.68% ->   4.42 0.07%:
1.09x speedup
▏
 xlib-rgb&       paint_image_rgb_over-256    4.45 0.27% ->   4.05 0.11%:
1.09x speedup
▏
 xlib-rgb&  paint_image_rgba_mag_over-256    3.03 0.43% ->   2.76 0.72%:
1.09x speedup
▏
 xlib-rgb&    paint_solid_rgba_source-256    0.73 0.59% ->   0.67 2.32%:
1.09x speedup
▏
 xlib-rgba       paint_solid_rgb_over-256    0.81 2.94% ->   0.75 2.57%:
1.09x speedup
▏
 xlib-rgb&       paint_solid_rgb_over-256    0.81 2.38% ->   0.74 3.21%:
1.09x speedup
▏
 xlib-rgb      paint_solid_rgb_source-256    0.76 2.38% ->   0.69 0.34%:
1.09x speedup
▏
 xlib-rgba&     paint_solid_rgb_source-256    0.77 0.50% ->   0.71
1.98%:  1.09x speedup
▏
 xlib-rgba     stroke_radial_rgb_over-128   12.48 0.15% ->  12.34 2.82%:
1.09x speedup
▏
 xlib-rgb        paint_solid_rgb_over-256    0.79 0.76% ->   0.73 0.18%:
1.08x speedup
▏
 xlib-rgb& paint_image_rgba_mag_source-256    3.03 0.58% ->   2.82
0.77%:  1.08x speedup
▏
 xlib-rgba& paint-with-alpha_image_rgba_min_source-256   21.50 0.49% ->
19.87 0.12%:  1.08x speedup
▏
 xlib-rgba    paint_solid_rgba_source-512    1.21 1.36% ->   1.12 0.78%:
1.08x speedup
▏
 xlib-rgb       paint_image_rgba_over-256    4.53 0.42% ->   4.17 0.08%:
1.08x speedup
▏
 xlib-rgba&     paint_solid_rgb_source-512    1.20 0.84% ->   1.11
1.55%:  1.08x speedup
▏
 xlib-rgb     paint_image_rgba_source-256    4.38 0.43% ->   4.08 0.28%:
1.08x speedup
▏
 xlib-rgba     paint_solid_rgb_source-512    1.22 1.84% ->   1.14 1.80%:
1.08x speedup
▏
 xlib-rgba&       paint_solid_rgb_over-512    1.24 1.18% ->   1.16
1.04%:  1.08x speedup
▏
 xlib-rgb        paint_image_rgb_over-256    4.21 0.28% ->   3.95 0.55%:
1.07x speedup
▏
 xlib-rgba       paint_solid_rgb_over-512    1.28 1.44% ->   1.19 0.37%:
1.07x speedup
▏
 xlib-rgb      paint_image_rgb_source-256    4.23 0.36% ->   3.93 0.15%:
1.07x speedup
▏
 xlib-rgba&    paint_solid_rgba_source-512    1.20 1.78% ->   1.12
1.16%:  1.07x speedup
▏
 xlib-rgb       paint_solid_rgba_over-256    1.07 3.12% ->   0.95 2.23%:
1.06x speedup

 xlib-rgba& paint-with-alpha_linear_rgba_over-256   17.25 0.45% ->
16.36 0.35%:  1.06x speedup

 xlib-rgba& paint-with-alpha_linear_rgba_source-256   18.21 0.14% ->
17.32 0.35%:  1.05x speedup

 xlib-rgba paint-with-alpha_linear_rgba_source-256   18.29 0.25% ->
17.39 0.13%:  1.05x speedup

 xlib-rgba& paint-with-alpha_linear_rgb_source-256   18.25 0.68% ->
17.32 0.30%:  1.05x speedup

 xlib-rgba& paint-with-alpha_linear_rgb_over-256   17.23 0.13% ->  16.50
1.38%:  1.05x speedup

 xlib-rgba paint-with-alpha_linear_rgb_source-256   18.43 0.88% ->
17.41 0.34%:  1.05x speedup

 xlib-rgba      text_image_rgb_source-256  121.11 0.09% -> 116.81 2.22%:
1.05x speedup

 xlib-rgba     text_image_rgba_source-256  120.73 0.12% -> 114.89 0.46%:
1.05x speedup

Slowdowns
=========
 xlib-rgba&      text_solid_rgb_source-128   24.64 4.62% ->  26.42
0.25%:  1.17x slowdown
▏
 xlib-rgba&   text_similar_rgba_source-128   25.99 6.06% ->  26.20
0.26%:  1.17x slowdown
▏
 xlib-rgba&    text_similar_rgb_source-128   26.32 7.88% ->  26.22
0.29%:  1.17x slowdown
▏
 xlib-rgba     text_solid_rgba_source-256   97.26 4.61% ->  98.56 0.14%:
1.14x slowdown
▏
 xlib-rgba    text_similar_rgb_source-256   97.45 4.75% ->  98.34 0.41%:
1.14x slowdown
▏
 xlib-rgba&                 rectangles-512   38.23 0.97% ->  43.15
1.16%:  1.13x slowdown
▏
 xlib-rgba   text_similar_rgba_source-256   97.36 4.53% ->  98.33 0.57%:
1.13x slowdown
▏
 xlib-rgba& text_image_rgba_mag_source-256  104.14 0.92% -> 113.43
0.65%:  1.08x slowdown
▏
 xlib-rgba     text_image_rgba_source-128   32.84 0.33% ->  35.45 0.49%:
1.08x slowdown
▏
 xlib-rgba      text_image_rgb_source-128   32.94 0.38% ->  35.31 0.38%:
1.07x slowdown
▏
 xlib-rgba&      text_image_rgb_source-128   32.26 0.39% ->  34.69
1.15%:  1.06x slowdown



nvidia FX5800, 2400MHz Athlon64
Speedups
========
 xlib-rgba&     paint_solid_rgb_source-256    0.09 0.81% ->   0.07
0.48%:  1.29x speedup
▎
 xlib-rgba&       paint_solid_rgb_over-256    0.09 0.81% ->   0.07
1.32%:  1.29x speedup
▎
 xlib-rgba     paint_solid_rgb_source-256    0.09 0.67% ->   0.08 0.36%:
1.23x speedup
▎
 xlib-rgba       paint_solid_rgb_over-256    0.09 0.39% ->   0.08 0.51%:
1.21x speedup
▎
 xlib-rgba&    paint_solid_rgba_source-256    0.10 0.49% ->   0.09
0.53%:  1.14x speedup
▏
 xlib-rgb     mosaic_tessellate_lines-800    5.64 0.63% ->   5.24 0.63%:
1.07x speedup
▏
 xlib-rgba&       paint_image_rgb_over-512    5.70 0.75% ->   5.32
0.78%:  1.07x speedup
▏
 xlib-rgba&    paint_image_rgba_source-512    5.70 0.75% ->   5.33
0.78%:  1.07x speedup
▏
 xlib-rgba&     paint_image_rgb_source-512    5.70 0.80% ->   5.32
0.77%:  1.07x speedup
▏
 xlib-rgba&      paint_image_rgba_over-512    5.75 0.81% ->   5.38
0.78%:  1.07x speedup
▏
 xlib-rgba    mosaic_tessellate_lines-800    5.62 0.56% ->   5.29 0.58%:
1.06x speedup
▏
 xlib-rgba              tessellate-64-100    0.53 0.62% ->   0.50 0.60%:
1.05x speedup

 xlib-rgba&              tessellate-64-100    0.53 0.67% ->   0.50
0.57%:  1.05x speedup

 xlib-rgba&              subimage_copy-256    0.07 0.73% ->   0.07
0.98%:  1.05x speedup

Slowdowns
=========
 xlib-rgba      pattern_create_radial-16     1.63 0.41% ->   2.35 0.45%:
1.44x slowdown
▍
 xlib-rgb       pattern_create_radial-16     1.81 0.38% ->   2.43 0.36%:
1.34x slowdown
▍
 xlib-rgb         text_image_rgb_over-256    6.04 0.59% ->   7.85 0.45%:
1.29x slowdown
▎
 xlib-rgba        text_image_rgb_over-256    6.06 0.60% ->   7.87 0.49%:
1.29x slowdown
▎
 xlib-rgb        text_image_rgba_over-256    6.04 0.57% ->   7.83 0.52%:
1.29x slowdown
▎
 xlib-rgba       text_image_rgba_over-256    6.06 0.67% ->   7.83 0.52%:
1.28x slowdown
▎
 xlib-rgba&      pattern_create_radial-16     1.92 0.94% ->   2.33
0.69%:  1.20x slowdown
▎
 xlib-rgb&      pattern_create_radial-16     1.95 0.44% ->   2.32 1.79%:
1.16x slowdown
▏
 xlib-rgba       text_image_rgba_over-128    1.59 0.38% ->   1.86 0.54%:
1.16x slowdown
▏
 xlib-rgb&        text_image_rgb_over-256    6.09 0.60% ->   7.06 0.58%:
1.15x slowdown
▏
 xlib-rgb&       text_image_rgba_over-256    6.05 0.57% ->   7.00 0.54%:
1.15x slowdown
▏
 xlib-rgba&        text_image_rgb_over-256    6.11 0.61% ->   7.07
0.59%:  1.15x slowdown
▏
 xlib-rgb        text_image_rgba_over-128    1.59 0.38% ->   1.82 0.82%:
1.15x slowdown
▏
 xlib-rgb         text_image_rgb_over-128    1.59 0.36% ->   1.84 1.54%:
1.14x slowdown
▏
 xlib-rgba&       text_image_rgba_over-256    6.08 0.56% ->   6.99
0.55%:  1.14x slowdown
▏
 xlib-rgba        text_image_rgb_over-128    1.61 0.44% ->   1.85 1.43%:
1.14x slowdown
▏
 xlib-rgba&       text_radial_rgb_over-64     1.10 5.84% ->   1.10
0.21%:  1.14x slowdown
▏
 xlib-rgb&       text_radial_rgb_over-64     1.11 6.28% ->   1.10 0.22%:
1.13x slowdown
▏
 xlib-rgb  paint_image_rgba_mag_source-256    4.33 0.56% ->   4.80
0.48%:  1.11x slowdown
▏
 xlib-rgba&        text_solid_rgb_over-128    0.88 0.35% ->   0.96
0.23%:  1.10x slowdown
▏
 xlib-rgba&       text_image_rgba_over-128    1.55 0.51% ->   1.68
0.67%:  1.08x slowdown
▏
 xlib-rgb&   fill_image_rgba_mag_over-128    0.64 0.43% ->   0.68 0.39%:
1.07x slowdown
▏
 xlib-rgba&        text_image_rgb_over-128    1.55 0.44% ->   1.68
0.59%:  1.07x slowdown
▏
 xlib-rgba        text_image_rgb_over-64     0.69 0.21% ->   0.74 0.37%:
1.07x slowdown
▏
 xlib-rgb&       text_image_rgba_over-128    1.55 0.46% ->   1.66 0.61%:
1.07x slowdown
▏
 xlib-rgb        text_image_rgba_over-64     0.69 0.26% ->   0.74 0.32%:
1.07x slowdown
▏
 xlib-rgb& fill_image_rgba_mag_source-128    0.73 0.49% ->   0.78 0.49%:
1.07x slowdown
▏
 xlib-rgb&        text_image_rgb_over-128    1.55 0.47% ->   1.65 0.62%:
1.06x slowdown
▏
 xlib-rgb&        text_image_rgb_over-64     0.57 0.41% ->   0.60 0.63%:
1.06x slowdown

 xlib-rgba& fill_image_rgba_mag_source-64     0.32 0.23% ->   0.33
0.18%:  1.06x slowdown

 xlib-rgb& fill_image_rgba_mag_source-64     0.32 0.21% ->   0.34 0.20%:
1.06x slowdown

 xlib-rgba       text_image_rgba_over-64     0.69 0.25% ->   0.74 0.43%:
1.06x slowdown

 xlib-rgb&       text_image_rgba_over-64     0.57 0.33% ->   0.61 0.64%:
1.06x slowdown

 xlib-rgb&   text_similar_rgba_source-128    1.57 2.44% ->   1.74 3.56%:
1.06x slowdown

 xlib-rgba&      text_similar_rgb_over-128    1.02 0.29% ->   1.07
0.32%:  1.06x slowdown

 xlib-rgb&     stroke_solid_rgba_over-128    0.73 0.56% ->   0.77 0.50%:
1.05x slowdown

 xlib-rgb&   fill_image_rgba_mag_over-64     0.28 0.15% ->   0.29 0.13%:
1.05x slowdown

 xlib-rgb&      text_solid_rgb_source-128    1.52 3.30% ->   1.68 3.09%:
1.05x slowdown

 xlib-rgb&   fill_image_rgba_min_over-64     0.38 1.44% ->   0.40 1.11%:
1.05x slowdown

 xlib-rgb& fill_image_rgba_min_source-64     0.44 1.00% ->   0.47 1.30%:
1.05x slowdown

 xlib-rgba&   fill_image_rgba_mag_over-64     0.28 0.26% ->   0.29
0.24%:  1.05x slowdown
-- 
Chris Wilson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-xshm-Basic-infrastructure.patch
Type: text/x-patch
Size: 0 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080816/b8892411/attachment-0001.bin 


More information about the cairo mailing list