Bug 34863

Summary: Crash in cairo perf "long_dashed_lines", "dragon" in cairo_stroke_preserve/cairo_stroke
Product: cairo Reporter: ranjeet.d
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: major    
Priority: medium    
Version: 1.10.0   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description ranjeet.d 2011-03-01 04:19:17 UTC
We have implemented a new Cairo backend "TestBackend" which does device specific rendering for cairo. 
In our case we rely for most of the rendering using fallback mechanism available in Cairo. cairo_TestBackend_surface_backend (cairo_shadow_backend_t) is shown below.

We have executed both Cairo Functional Test Suite and Cairo Performance Test Suite. With Functional test cases we had no issues with cairo or backend but with two perf test cases "long dashed lines" and "dragon" we found a runtime crash. Call stack is given below the table.

We checked other backends like win32/xlib and found that they don't provide stoke API too since they don't support native Vector Rendering but they provide fill_rectangle API implementation.
In our case we don't even provide fill_rectangles since we can't handle so many ROPs and we see some artifacts for incomplete fill_rectangles implementation.

If we keep fill_rectangles in our backend function table (incomplete though) then crash doesn't happen, but if we remove fill_rectangles then we see the crash in both the test cases.

Please let us know if this is a bug or because of incomplete implementation of backend and suggest some solution.

const cairo_surface_backend_t cairo_TestBackend_surface_backend = 
{
	(cairo_surface_type_t)CAIRO_SURFACE_TYPE_TEST_BACKEND,
	Cairo_TestBackend_Surface_create_similar,
	Cairo_TestBackend_Surface_finish,
	Cairo_TestBackend_Surface_acquire_source_image,
	Cairo_TestBackend_Surface_release_source_image,
	Cairo_TestBackend_Surface_acquire_dest_image,
	Cairo_TestBackend_Surface_release_dest_image,
	NULL, /* clone_similar */
	NULL, /* composite */
	NULL, /* fill_rectangles */
	NULL, /* composite_trapezoids */
	NULL, /* copy_page */
	NULL, /* show_page */
	NULL, /* previous: copy_page */ /*new: set_clip_region*/
	NULL, /* previous: show_page */ /*new: intersect_clip_path*/
	Cairo_TestBackend_Surface_get_extents, /* previous: NULL */ /*new: get_extents*/
	NULL, /* previous: intersect_clip_path */ /*new: old_show_glyphs*/
	NULL, /* previous: Cairo_TestBackend_Surface_get_extents*/ /*new: get_font_options*/
	NULL, /* previous: old_show_glyphs */ /*new: flush*/
	NULL, /* mark_dirty_rectangle */
	NULL, /* previous: Cairo_TestBackend_Surface_flush */ /*new: scaled_font_fini*/
	NULL, /* previous: mark_dirty_rectangle */ /*new: scaled_glyph_fini*/
	NULL, /* paint */
	NULL, /* mask */
	NULL, /* previous: paint */ /*new: stroke*/
	NULL, /* previous: mask */ /*new: fill*/
	NULL, /* previous: stroke */ /*new: show_glyphs*/
	NULL, /* previous: fill */ /*new: snapshot*/
	Cairo_TestBackend_Surface_is_similar,  /* previous: NULL*/ /*new: is_similar*/
	NULL, /* previous: snapshot */ /*new: reset*/
	NULL, /* previous: Cairo_TestBackend_Surface_is_similar*/ /*new: fill_stroke*/
	NULL, /* create_solid_pattern_surface*/
	NULL, /* previous: fill_stroke */ /*new: has_show_text_glyphs*/
	NULL  /* show_text_glyphs*/
};



Call Stack

 	CairoTestBackendSample.exe!_cairo_image_surface_fill_rectangles(void * abstract_surface=0x076b2048, _cairo_operator op=CAIRO_OPERATOR_OVER, const _cairo_color * color=0x0012fa60, _cairo_rectangle_int * rects=0x076b3980, int num_rects=2377)  Line 4262 + 0x9 bytes	C
 	CairoTestBackendSample.exe!_cairo_surface_fill_rectangles(_cairo_surface * surface=0x076b2048, _cairo_operator op=CAIRO_OPERATOR_OVER, const _cairo_color * color=0x0012fa60, _cairo_rectangle_int * rects=0x076b3980, int num_rects=2377)  Line 1960 + 0x1e bytes	C
 	CairoTestBackendSample.exe!_cairo_surface_fallback_fill_rectangles(_cairo_surface * surface=0x00b9f5e8, _cairo_operator op=CAIRO_OPERATOR_OVER, const _cairo_color * color=0x0012fa60, _cairo_rectangle_int * rects=0x076b3980, int num_rects=2377)  Line 1513 + 0x19 bytes	C
 	CairoTestBackendSample.exe!_cairo_surface_fill_rectangles(_cairo_surface * surface=0x00b9f5e8, _cairo_operator op=CAIRO_OPERATOR_OVER, const _cairo_color * color=0x0012fa60, _cairo_rectangle_int * rects=0x076b3980, int num_rects=2377)  Line 1968 + 0x19 bytes	C
 	CairoTestBackendSample.exe!_fill_rectangles(_cairo_surface * dst=0x00b9f5e8, _cairo_operator op=CAIRO_OPERATOR_OVER, const _cairo_pattern * src=0x0012fa00, _cairo_traps * traps=0x0012f69c, _cairo_clip * clip=0x00000000)  Line 724 + 0x22 bytes	C
 	CairoTestBackendSample.exe!_clip_and_composite_trapezoids(const _cairo_pattern * src=0x0012fa00, _cairo_operator op=CAIRO_OPERATOR_OVER, _cairo_surface * dst=0x00b9f5e8, _cairo_traps * traps=0x0012f69c, _cairo_antialias antialias=CAIRO_ANTIALIAS_DEFAULT, _cairo_clip * clip=0x00000000, _cairo_rectangle_int * extents=0x0012f084)  Line 808 + 0x19 bytes	C
 	CairoTestBackendSample.exe!_cairo_surface_fallback_stroke(_cairo_surface * surface=0x00b9f5e8, _cairo_operator op=CAIRO_OPERATOR_OVER, const _cairo_pattern * source=0x0012fa00, _cairo_path_fixed * path=0x00b9fa0c, const _cairo_stroke_style * stroke_style=0x0012f9d8, const _cairo_matrix * ctm=0x00b9f968, const _cairo_matrix * ctm_inverse=0x00b9f998, double tolerance=0.10000000000000001, _cairo_antialias antialias=CAIRO_ANTIALIAS_DEFAULT, _cairo_clip * clip=0x00000000)  Line 1116 + 0x4a bytes	C
 	CairoTestBackendSample.exe!_cairo_surface_stroke(_cairo_surface * surface=0x00b9f5e8, _cairo_operator op=CAIRO_OPERATOR_OVER, const _cairo_pattern * source=0x0012fa00, _cairo_path_fixed * path=0x00b9fa0c, const _cairo_stroke_style * stroke_style=0x0012f9d8, const _cairo_matrix * ctm=0x00b9f968, const _cairo_matrix * ctm_inverse=0x00b9f998, double tolerance=0.10000000000000001, _cairo_antialias antialias=CAIRO_ANTIALIAS_DEFAULT, _cairo_clip * clip=0x00000000)  Line 2219 + 0x32 bytes	C
 	CairoTestBackendSample.exe!_cairo_gstate_stroke(_cairo_gstate * gstate=0x00b9f8b0, _cairo_path_fixed * path=0x00b9fa0c)  Line 1175 + 0x66 bytes	C
 	CairoTestBackendSample.exe!cairo_stroke_preserve(_cairo * cr=0x00b9f738)  Line 2405 + 0x16 bytes	C
Comment 1 Chris Wilson 2012-04-11 08:19:50 UTC
In hindsight, this is simply due to not providing the lowlevel function (fill_rectangles) and triggering a fallback that ended up in the same lowlevel function.

That code is now thankfully obsolete.

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.