[cairo] Solid pattern caching revisited

Chris Wilson chris at chris-wilson.co.uk
Fri May 4 07:39:33 PDT 2007


Behdad Esfahbod (behdad at behdad.org) said: 
> What if we remove the surface from the cache when in use, and reset its
> attributes when putting it back?

This works surprising well as pattern surfaces were only being shared in
a couple of the tests i.e. a relatively rare occurrence.
However, the true problem was not the sharing of the surfaces, but that
is_compatible() wasn't stringent enough as it allowed the reuse of
surfaces that were not equivalent to those returned by create_similar().
Hence I replace that test with an is_similar() check that needs to jump
through a few more hoops in the backend.

I believe the solid-pattern-cache2 branch is ready for a final review
and merge.
[http://gitweb.freedesktop.org/?p=users/ickle/cairo;a=shortlog;h=solid-pattern-cache2]

Highlights of the branch are that it implements an 'evince-safe' surface
cache with:-

Cache hit rates:    (hit same index + hit in cache) / lookups
cairo-perf:         (42346 + 28480) / 159600 = 44.38%
gtk-theme-torturer: (3023  + 3502)  / 6528   = 99.95%
gtk-perf:           (8270  + 3190)  / 21504  = 53.29%

Which translates into a reduction of about 25% of the XRENDER traffic
during cairo-perf.
--
Chris Wilson


More information about the cairo mailing list