[cairo] Regarding performance and memory usage of the recording surface
백현기
hyunki.baik at samsung.com
Thu May 26 19:34:48 PDT 2011
Hello all,
I have been testing the web-browser application which uses cairo recording surfaces.
I have found that cairo uses a large amount of memory (more than 250MB) when I try to perform panning operations to navigate a web-page with a high zoom rate (e.g. NYTimes. The page size with 4x zoom rate is 3888x14324). Sometimes system crash occurred on that situation.
I have investigated the reason and it turns out that there are many snapshot images created by replaying process for recording surfaces. (In fact, more than 10,000 recording surfaces(128x128 ARGB pixels) can be used for above situations.)
And I think the replay process can be improved if it can replay recorded operations onto destination surface directly (not snapshot image) when the operation is SRC operation and size between recording surface and destination surface is equal. (i.e. transformation matrix has only a translation vector.)
I have tested the performance for replaying operation between original cairo recording surface replaying and modifed replaying version which do not have snapshot images and perform the replaying onto destination surface directly.
(I have modified the _composite_boxes() funtion in cairo-image-surface.c file and the _cairo_recording_surface_acquire_source_image() in cairo-recording-surface.c file.)
In the experiment, up to 2x speedup can be observed.
Based on that situation, I'd like to ask some questions.
(1) Do you have a plan to support "disable snapshot mode" for the recording surface? (by parameter when recording surface is created or by build option)
(2) Do you have a plan to support "direct replay mode" to destination surface to avoid the additional copy from snapshot to destination surface if the snapshot is not used and the operation between recording and dst surfaces is 1:1 src operation. (i.e. bit-blit operation)
I also like to ask to review my source code patch to support above (1) and (2).
Thank you very much.
Hyunki Baik
Senior Engineer
Samsung Electronics
More information about the cairo
mailing list