Bug 5528

Summary: _XError from XRenderCompositeText8
Product: cairo Reporter: Jon Kåre Hellan <hellan>
Component: xlib backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: high    
Version: 0.2.0   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Jon Kåre Hellan 2006-01-07 05:33:48 UTC
A long string causes XRenderCompositeText8 to throw an _XError. It can be
reproduced in several ways:

=rept("x",2^16-1) in gnumeric

paste a string of 65535 x's into gedit.

Backtrace from gnumeric:

#0  0xb7aa384e in write () from /lib/tls/libc.so.6
#1  0xb6d684d7 in XUnlockDisplay () from /usr/X11R6/lib/libX11.so.6
#2  0xb6d68777 in _X11TransWrite () from /usr/X11R6/lib/libX11.so.6
#3  0xb6d4c7be in _XError () from /usr/X11R6/lib/libX11.so.6
#4  0xb6de53d4 in XRenderCompositeText8 (dpy=0x8077708, op=3, src=54526757,
    dst=54526754, maskFormat=0x824bb08, xSrc=3, ySrc=13, xDst=7, yDst=0,
    elts=0xb6217008, nelt=65535) at Glyph.c:478
#5  0xb70a8616 in _cairo_xlib_surface_show_glyphs8 (scaled_font=0x83a0398,
    operator=CAIRO_OPERATOR_OVER, cache=0x8394e98, key=0xbf92cd38,
    src=0x84279a0, self=0x8395018, source_x=0, source_y=0, glyphs=0xb6398008,
    entries=0xb6357008, num_glyphs=65535) at cairo-xlib-surface.c:2611
#6  0xb70a8bde in _cairo_xlib_surface_show_glyphs (scaled_font=0x83a0398,
    operator=CAIRO_OPERATOR_OVER, pattern=0xbf92d074,
    abstract_surface=0x8395018, source_x=3, source_y=6, dest_x=3, dest_y=6,
    width=16380, height=7, glyphs=0xb6398008, num_glyphs=65535)
    at cairo-xlib-surface.c:2782
#7  0xb709819d in _cairo_surface_show_glyphs (scaled_font=0x83a0398,
    operator=CAIRO_OPERATOR_OVER, pattern=0xbf92d074, dst=0x8395018,
    source_x=3, source_y=6, dest_x=3, dest_y=6, width=16380, height=7,
    glyphs=0xb6398008, num_glyphs=65535) at cairo-surface.c:1494
#8  0xb708a625 in _cairo_scaled_font_show_glyphs (scaled_font=0x83a0398,
    operator=CAIRO_OPERATOR_OVER, pattern=0xbf92d074, surface=0x8395018,
    source_x=3, source_y=6, dest_x=3, dest_y=6, width=16380, height=7,
    glyphs=0xb6398008, num_glyphs=65535) at cairo-font.c:930
#9  0xb708e780 in _cairo_gstate_show_glyphs_draw_func (closure=0xbf92d050,
    operator=CAIRO_OPERATOR_OVER, src=0xbf92d074, dst=0x8395018, dst_x=0,
    dst_y=0, extents=0xbf92d05c) at cairo-gstate.c:2053
#10 0xb708cd49 in _cairo_gstate_clip_and_composite (clip=0x84278ac,
    operator=CAIRO_OPERATOR_OVER, src=0xbf92d074,
    draw_func=0xb708e60d <_cairo_gstate_show_glyphs_draw_func>,
    draw_closure=0xbf92d050, dst=0x8395018, extents=0xbf92d05c)
    at cairo-gstate.c:1094
#11 0xb708ea16 in _cairo_gstate_show_glyphs (gstate=0x8427828,
    glyphs=0xb64d8008, num_glyphs=65535) at cairo-gstate.c:2131
#12 0xb70869c9 in cairo_show_glyphs (cr=0x8427250, glyphs=0xb64d8008,
    num_glyphs=65535) at cairo.c:2158
#13 0xb70de524 in pango_cairo_renderer_draw_glyphs (renderer=0x83943a8,
    font=0x83a3480, glyphs=0x8395710, x=0, y=0) at pangocairo-render.c:110
#14 0xb7416604 in pango_renderer_draw_glyphs (renderer=0x83943a8,
    font=0x83a3480, glyphs=0x8395710, x=0, y=0) at pango-renderer.c:597
#15 0xb70dec0e in pango_cairo_show_glyph_string (cr=0x8427250,
    font=0x83a3480, glyphs=0x8395710) at pangocairo-render.c:314
#16 0xb744d221 in gdk_pango_renderer_draw_glyphs (renderer=0x8393d10,
    font=0x83a3480, glyphs=0x8395710, x=3072, y=14335) at gdkpango.c:210
#17 0xb7416604 in pango_renderer_draw_glyphs (renderer=0x8393d10,
    font=0x83a3480, glyphs=0x8395710, x=3072, y=14335) at pango-renderer.c:597
#18 0xb74163e1 in pango_renderer_draw_layout_line (renderer=0x8393d10,
    line=0x8394680, x=3072, y=14335) at pango-renderer.c:528
#19 0xb7415bac in pango_renderer_draw_layout (renderer=0x8393d10,
    layout=0x83b8ab8, x=3072, y=1024) at pango-renderer.c:182
#20 0xb744ecde in IA__gdk_draw_layout_with_colors (drawable=0x838feb8,
    gc=0x83907a8, x=3, y=1, layout=0x83b8ab8, foreground=0x0, background=0x0)
    at gdkpango.c:989
#21 0xb744efb7 in IA__gdk_draw_layout (drawable=0x838feb8, gc=0x83907a8, x=3,
    y=1, layout=0x83b8ab8) at gdkpango.c:1051
#22 0xb7ba2b90 in cell_draw (cell=0x83c10dc, gc=0x83907a8,
    drawable=0x838feb8, x1=0, y1=0, width=16380, height=16, h_center=32)
    at cell-draw.c:282 

In XRenderCompositeText8, nelt is 65535, req->length=4
It looks like there are 65535 little elements with one "x" each.

This wasn't a problem in pre Cairo gtk - Xft limits itself to 1024 chars at a time.
Comment 1 Keith Packard 2006-01-07 06:26:41 UTC
The X render library cannot legitimately split things up into chunks, that must
be done by the upper level library, in this case, cairo. I've moved the bug to
that product.
Comment 2 Carl Worth 2006-03-04 10:50:40 UTC
I've added new chunking code to _cairo_xlib_surface_[old_]show_glyphs.

This is now committed to both the 1.1 and 1.0 lines.

There's also a new show-glyphs-many test which verifies that 65536 glyphs can be
rendered in a single call to cairo_show_glyphs.

Thanks for the bug report,

-Carl

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.