[cairo] PATCH: GL: Create glyph mask surface only once per context, enlarge on demand

Martin Robinson mrobinson at igalia.com
Wed Apr 24 13:42:04 PDT 2013


On 02/16/2013 02:12 AM, Chris Wilson wrote:
> Because I want to promote better drivers. Working around issues that can
> be easily fixed in the driver for the betterment of all, just leads to
> stagnation as nobody feels the impetus to do anything.

It's always good to have numbers in discussions like these. I wrote a
tiny HTML5 canvas micro test [1] that just renders text (with
overlapping glyphs which trigger the mask path) as fast as possible over
a period of 3 seconds. The test measures number of renders per second
and takes 10 samples. I repeated this test on two systems, one with
Intel hardware and one with an NVidia hardware [2]. I'm willing to
collect more data (AMD and perhaps a Mali device) if it's interesting.

(units are text paints per millisecond)

image-nvidia: 55.1969049523432 (stddev: 0.878697193173796)
image-intel: 64.1527714098772 (stddev: 0.234850204049565)
gl-nvidia (before patch) 0.233834194694391 (stddev: 0.002959739753409)
gl-nvidia (after patch): 17.2066024223006 (stddev: 0.424291496997496)
gl-intel (before patch): 13.9265171859729 (stddev: 0.175320467059827)
gl-intel (after patch): 17.1163946835002 (stddev: 0.157778076619366)

So while on Intel hardware it is nowhere near as dramatic as on NVidia,
there still seems to be some improvement.

Perhaps a more abstract framebuffer caching mechanism would be less
ugly? cairo-traces show a lot of calls to cairo_push_group and/or
cairo_create_similar (and then a quick destruction). This essentially
makes the GL backend of Cairo unsuitable for toolkit rendering, as the
overhead for creating and binding a new framebuffer runs the gamut from
slightly expensive to outlandish.

As an aside, no matter what, avoiding the mask path is always much, much
faster (~30 r/ms for Intel and ~40 r/ms for NVidia), so we should
probably be trying harder to avoid it. I don't think the pixels of Times
New Roman in this string actually overlap.

1.
https://github.com/mrobinson/cairo-perf-monitor/blob/master/canvas-micro-tests/overlapping-text.js

2. GPU/driver details:

model name	: Intel(R) Core(TM) i7-2620M CPU @ 2.70GHz
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile
OpenGL version string: 3.0 Mesa 9.0
OpenGL shading language version string: 1.30

model name:     : AMD Phenom(tm) II X6 1090T Processor
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTS 250/PCIe/SSE2
OpenGL version string: 3.3.0 NVIDIA 310.14
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler

Thanks!

--Martin



More information about the cairo mailing list