[cairo] [cairo-xlib] Cache standard xrender formats

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 16 01:44:24 PDT 2008

On Wed, 2008-07-16 at 17:33 +1200, Karl Tomlinson wrote:
> This change implemented caching of standard XRender formats:
> http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=fda95868020effcbc56ff687a763af650a758ba2;hp=8457374c9cf350841a7c16f1ef1657aeb354e5c9
> The reason given was:
>   XRender performs a round-trip in order to query the available formats on
>   the xserver, before searching for a matching format. In order to save
>   that round-trip and to avoid the short-lived allocation of the array of
>   available formats, we cache the result on the display.
> AFAICT XRenderQueryFormats only performs that round trip once per process (in
> libXrender-0.9.2 at least), and caches the necessary information.
> http://gitweb.freedesktop.org/?p=xorg/lib/libXrender.git;a=blob;h=3a51663f8813a6c88386333f95d565cc277fbc40;hb=9779025f33c917b74349200e6018d0c94d6ff0ab;f=src/Xrender.c#l419
> That LockDisplay(dpy) is just for thread safety within the process,
> right (i.e no round trip)?
> Or am I missing a round trip somewhere else?

No. I wrote that patch some time ago to trim a few redundant calls from
an xtrace (and even the mallocs were apparent in the profiles). However,
it now appears to be entirely superfluous and can be dropped.
Chris Wilson

More information about the cairo mailing list