[cairo] [cairo-commit] 5 commits - src/cairo-xlib-surface.c

Chris Wilson chris at chris-wilson.co.uk
Sat Oct 4 01:18:56 PDT 2008


On Fri, 2008-10-03 at 19:06 -0700, Bill Spitzak wrote:
> > On Tue, 2008-09-30 at 14:56 -0700, Behdad Esfahbod wrote:
> >>     [xlib] Start a new glyph element every 128 glyphs
> >>     
> >>     Xrender has limits at 252 glyphs.  We play safe and fast and limit
> >>     elements to 128 glyphs.  That's plenty, no measurable performance
> >>     hit expected.
> 
> I actually found that the Xrender bug is that it will crash if the 
> number of glyphs is such that (N&0xff)>252. Ie 256 will work. The 
> work-around I used was to add 1 or 2 spaces to the end in these cases. 
> Not sure if that would be better or worse than what you are doing.

For reference this is (one-half of) the bit of code in
libXrender/src/Glyph.c that is causing the trouble,
XRenderCompositeText8 (and similar in the other CompositeText
functions):
  /*
   * xGlyphElt must be aligned on a 32-bit boundary; this is
   * easily done by filling no more than 252 glyphs in each
   * bucket
   */
  elen = SIZEOF(xGlyphElt) * ((nchars + MAX_8-1) / MAX_8) + nchars;
  len += (elen + 3) >> 2;

Where libXrender explicity inserts new xGlyphElts into the stream every
252 glyphs into an existing xGlyphElts.
-- 
Chris Wilson



More information about the cairo mailing list