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

Karl Tomlinson cairo at karlt.net
Tue Jul 15 22:33:02 PDT 2008


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?

The reason I'm interested is that I want to find the Visual
corresponding to a XRenderPictFormat (when there is one), and the
simplest way to do that is to use the inverse
XRenderFindVisualFormat(), but that would suffer the same issues
as XRenderFindStandardFormat (if there are any such issues).

Thanks,
Karl.


More information about the cairo mailing list