Bug 39373

Summary: cairo-xlib hangs with render 0.0
Product: cairo Reporter: Uli Schlachter <psychon>
Component: xlib backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.10.3   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Uli Schlachter 2011-07-19 07:02:33 UTC
Hi,

For some weird reason I experimented with the CAIRO_DEBUG env var and noticed that "CAIRO_DEBUG=xrender-version=0.0 gvim" hangs.

Cairo is trying to lock _cairo_pattern_solid_surface_cache_lock in _cairo_pattern_acquire_surface_for_solid, but this non-recursive mutex is already locked by the current thread in an earlier call to _cairo_pattern_acquire_surface_for_solid (See frames 3 and 16).

This only happens with CAIRO_DEBUG=xrender-version=0.0 because of the following code in cairo-xlib-surface.c, line 2800 (RENDER 0.1 introduced XRenderFillRectangle()):

    if (!CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLES (surface)) {
	if (op == CAIRO_OPERATOR_CLEAR ||
	    ((op == CAIRO_OPERATOR_SOURCE || op == CAIRO_OPERATOR_OVER) &&
	     CAIRO_COLOR_IS_OPAQUE (color)))
	{
	    return _cairo_xlib_surface_solid_fill_rectangles (surface, color,
							      rects, num_rects);
	}

	return UNSUPPORTED ("no support for FillRectangles with this op");
    }


Backtrace for the relevant thread:

Thread 1 (Thread 0x7f33729bf960 (LWP 32730)):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
#1  0x00007f336f8d0329 in _L_lock_926 () from /lib/x86_64-linux-gnu/libpthread.so.0
#2  0x00007f336f8d014b in __pthread_mutex_lock (mutex=0x7f336e029360) at pthread_mutex_lock.c:61
#3  0x00007f336dd9399c in _cairo_pattern_acquire_surface_for_solid (pattern=0x7fff2f6b21c0, dst=0x269db20, x=0, y=0, width=4, height=4, flags=0, 
    surface_out=0x7fff2f6b2a20, attributes=0x7fff2f6b29c0) at cairo-pattern.c:2403
#4  _cairo_pattern_acquire_surface (pattern=0x7fff2f6b21c0, dst=0x269db20, x=0, y=0, width=4, height=4, flags=0, surface_out=0x7fff2f6b2a20, 
    attributes=0x7fff2f6b29c0) at cairo-pattern.c:4063
#5  0x00007f336ddcd66a in _cairo_xlib_surface_solid_fill_rectangles (abstract_surface=0x269db20, op=<value optimized out>, color=0x7fff2f6b3cd0, 
    rects=0x7fff2f6b2a90, num_rects=1) at cairo-xlib-surface.c:2748
#6  _cairo_xlib_surface_fill_rectangles (abstract_surface=0x269db20, op=<value optimized out>, color=0x7fff2f6b3cd0, rects=0x7fff2f6b2a90, num_rects=1)
    at cairo-xlib-surface.c:2805
#7  0x00007f336dda491d in _cairo_surface_fill_rectangles (surface=0x269db20, op=CAIRO_OPERATOR_SOURCE, color=0x7fff2f6b3cd0, region=<value optimized out>)
    at cairo-surface.c:1963
#8  _cairo_surface_fill_rectangles (surface=0x269db20, op=CAIRO_OPERATOR_SOURCE, color=0x7fff2f6b3cd0, region=<value optimized out>) at cairo-surface.c:1880
#9  _cairo_surface_fill_region (surface=0x269db20, op=CAIRO_OPERATOR_SOURCE, color=0x7fff2f6b3cd0, region=<value optimized out>) at cairo-surface.c:1920
#10 0x00007f336ddaa8c0 in _clip_and_composite_region (src=0x7fff2f6b3c50, op=CAIRO_OPERATOR_SOURCE, dst=0x269db20, traps=0x7fff2f6b3480, 
    antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x0, extents=0x7fff2f6b3ba0) at cairo-surface-fallback.c:618
#11 _clip_and_composite_trapezoids (src=0x7fff2f6b3c50, op=CAIRO_OPERATOR_SOURCE, dst=0x269db20, traps=0x7fff2f6b3480, antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x0, 
    extents=0x7fff2f6b3ba0) at cairo-surface-fallback.c:847
#12 0x00007f336ddaaab6 in _cairo_surface_fallback_paint (surface=0x269db20, op=CAIRO_OPERATOR_SOURCE, source=0x7fff2f6b3c50, clip=0x0)
    at cairo-surface-fallback.c:936
#13 0x00007f336dda6f79 in _cairo_surface_paint (surface=0x269db20, op=CAIRO_OPERATOR_SOURCE, source=0x7fff2f6b3c50, clip=0x0) at cairo-surface.c:2032
#14 _cairo_surface_paint (surface=0x269db20, op=CAIRO_OPERATOR_SOURCE, source=0x7fff2f6b3c50, clip=0x0) at cairo-surface.c:1998
#15 0x00007f336dda8bdb in _cairo_surface_create_similar_solid (other=<value optimized out>, content=CAIRO_CONTENT_COLOR, width=1, height=1, color=0x7fff2f6b4070, 
    allow_fallback=0) at cairo-surface.c:538
#16 0x00007f336dd93f4e in _cairo_pattern_acquire_surface_for_solid (pattern=<value optimized out>, dst=0x269d1c0, x=0, y=0, width=<value optimized out>, 
    height=<value optimized out>, flags=0, surface_out=0x7fff2f6b4850, attributes=0x7fff2f6b47f0) at cairo-pattern.c:2449
#17 _cairo_pattern_acquire_surface (pattern=<value optimized out>, dst=0x269d1c0, x=0, y=0, width=<value optimized out>, height=<value optimized out>, flags=0, 
    surface_out=0x7fff2f6b4850, attributes=0x7fff2f6b47f0) at cairo-pattern.c:4063
#18 0x00007f336ddcd66a in _cairo_xlib_surface_solid_fill_rectangles (abstract_surface=0x269d1c0, op=<value optimized out>, color=0x7fff2f6b5b40, 
    rects=0x7fff2f6b4900, num_rects=1) at cairo-xlib-surface.c:2748
#19 _cairo_xlib_surface_fill_rectangles (abstract_surface=0x269d1c0, op=<value optimized out>, color=0x7fff2f6b5b40, rects=0x7fff2f6b4900, num_rects=1)
    at cairo-xlib-surface.c:2805
#20 0x00007f336dda6d72 in _cairo_surface_fill_rectangles (surface=0x269d1c0, op=CAIRO_OPERATOR_OVER, color=0x7fff2f6b5b40, rects=0x7fff2f6b4900, num_rects=1)
    at cairo-surface.c:1963
#21 _cairo_surface_fill_rectangles (surface=0x269d1c0, op=CAIRO_OPERATOR_OVER, color=0x7fff2f6b5b40, rects=0x7fff2f6b4900, num_rects=1) at cairo-surface.c:1946
#22 0x00007f336dda9aed in _fill_rectangles (dst=0x269d1c0, op=CAIRO_OPERATOR_OVER, src=<value optimized out>, traps=<value optimized out>, 
    clip=<value optimized out>) at cairo-surface-fallback.c:725
#23 0x00007f336ddaa387 in _clip_and_composite_trapezoids (src=0x7fff2f6b5ac0, op=CAIRO_OPERATOR_OVER, dst=0x269d1c0, traps=0x7fff2f6b52e0, 
    antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x0, extents=0x7fff2f6b5a00) at cairo-surface-fallback.c:809
#24 0x00007f336ddaaab6 in _cairo_surface_fallback_paint (surface=0x269d1c0, op=CAIRO_OPERATOR_OVER, source=0x7fff2f6b5ac0, clip=0x0) at cairo-surface-fallback.c:936
#25 0x00007f336dda6f79 in _cairo_surface_paint (surface=0x269d1c0, op=CAIRO_OPERATOR_OVER, source=0x7fff2f6b5ac0, clip=0x0) at cairo-surface.c:2032
#26 _cairo_surface_paint (surface=0x269d1c0, op=CAIRO_OPERATOR_OVER, source=0x7fff2f6b5ac0, clip=0x0) at cairo-surface.c:1998
#27 0x00007f336dd72f9c in _cairo_gstate_fill (gstate=0x269d440, path=0x269d788) at cairo-gstate.c:1300
---Type <return> to continue, or q <return> to quit--- 
#28 0x00007f336dd74f7d in _cairo_gstate_fill (gstate=0x269d440, path=0x269d788) at cairo-gstate.c:1267
#29 0x00007f336dd6e858 in _cairo_default_context_fill (abstract_cr=0x269d410) at cairo-default-context.c:999
#30 0x00007f336dd6835a in cairo_fill (cr=0x269d410) at cairo.c:2099
#31 0x00007f3371f08922 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#32 0x00007f3371f0b004 in gdk_window_begin_paint_region () from /usr/lib/libgdk-x11-2.0.so.0
#33 0x00007f33722bf55f in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#34 0x00007f3371f0fcf2 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#35 0x00007f3371f0fc9f in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#36 0x00007f3371f0ac2b in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#37 0x00007f3371f0ce39 in gdk_window_process_all_updates () from /usr/lib/libgdk-x11-2.0.so.0
#38 0x00007f3371f0cea9 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#39 0x00007f3371eea126 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#40 0x00007f33712de4a3 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#41 0x00007f33712dec80 in ?? () from /lib/libglib-2.0.so.0
#42 0x00007f33712def1d in g_main_context_iteration () from /lib/libglib-2.0.so.0
#43 0x00000000005a0935 in gui_mch_update ()
#44 0x00000000005955bc in gui_init ()
#45 0x000000000057c9e8 in set_termname ()
#46 0x0000000000596867 in gui_start ()
#47 0x000000000043bf95 in main ()
Comment 1 Uli Schlachter 2012-01-17 11:07:36 UTC
Cannot reproduce any more, so bug was fixed.

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.