<HTML><HEAD><TITLE>Samsung Enterprise Portal mySingle</TITLE>
<META content="text/html; charset=euc-kr" http-equiv=Content-Type>
<STYLE id=mysingle_style>P {
        MARGIN-TOP: 5px; FONT-FAMILY: ±¼¸²Ã¼, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
TD {
        MARGIN-TOP: 5px; FONT-FAMILY: ±¼¸²Ã¼, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
LI {
        MARGIN-TOP: 5px; FONT-FAMILY: ±¼¸²Ã¼, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
BODY {
        LINE-HEIGHT: 1.4; MARGIN: 10px; FONT-FAMILY: ±¼¸²Ã¼, arial; FONT-SIZE: 9pt
}
</STYLE>
<META name=GENERATOR content=ActiveSquare></HEAD>
<BODY>
<P>Hello.</P>
<P> </P>
<P>It's delivering patch.</P>
<P> </P>
<P>I'm younghwan working with HKBAIK on this issue.</P>
<P> </P>
<P>please see and review the patch file attached.</P>
<P> </P>
<P>Younghwan.</P>
<P> </P>
<P>------- <B>Original Message</B> -------</P>
<P><B>Sender</B> : ¹éÇö±â<hyunki.baik@samsung.com> E5(Ã¥ÀÓ)/Ã¥ÀÓ/System S/W±×·ì(¹«¼±)/»ï¼ºÀüÀÚ</P>
<P><B>Date</B> : 2011-05-27 16:31 (GMT+09:00)</P>
<P><B>Title</B> : Re: [cairo] Regarding performance and memory usage of the recording surface</P>
<P> </P>
<META name=GENERATOR content=ActiveSquare>
<P>Thank you for reply.</P>
<P>Please see (HKBAIK) indications.</P>
<P> </P>
<P>Hyunki Baik<BR><BR>------- Original Message -------<BR>Sender : Andrea Canciani<ranma42@gmail.com> <BR>Date : 2011-05-27 14:41 (GMT+09:00)<BR>Title : Re: [cairo] Regarding performance and memory usage of the recording surface<BR><BR>On Fri, May 27, 2011 at 4:34 AM, ¹éÇö±â <hyunki.baik@samsung.com> wrote:<BR>> Hello all,<BR>><BR>> I have been testing the web-browser application which uses cairo recording surfaces.<BR>> 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.<BR>> 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.)<BR>><BR>> 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.)<BR>> 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.<BR>> (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.)<BR>> In the experiment, up to 2x speedup can be observed.<BR>><BR>> Based on that situation, I'd like to ask some questions.<BR>><BR>> (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)<BR><BR>I'm not sure I understand what this mode is supposed to do. Could you<BR>explain it?</P>
<P> </P>
<P>(HKBAIK) </P>
<P>As I described below, when I navigate the highly zoomed web page, cairo recording surface takes a larget amount of memory because of snapshot images for their recording surfaces.</P>
<P>> 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.<BR>When I commented out the line "_cairo_surface_attach_snapshot (&surface->base, image, NULL);" in _cairo_recording_surface_acquire_source_image() function in cairo-recording-surface.c file, it doesn't take a large memory any more even if it doesn't give caching effect for second replay. (i.e. as like the first replay, second replay also requires operation-level replay again, not using the snapshot image.) </P>
<P>Therefore, to avoid to allocate unlimited memory size for snapshot images from recording surfaces, I think it would be comvenient if some options about snapshot management are provided as below. </P>
<P>(1) manages all snapshot images for all recording surfaces</P>
<P>(2) do not keep a snapshot image after replaying the recording surface (I know, it requires operation replaying process for subsequent replays. but this option can be useful if the application or library which uses cairo library also have the bitmap cache for already replayed surfaces.)</P>
<P>(3) manages snapshot images pool up to specified maxmimum size as like the cache pool (ex: 50MB, 100MB...)</P>
<P><BR><BR>> (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)<BR><BR>There is some support for "direct replay mode" in some backends, but<BR>it is currently a backend-dependent feature.<BR>It would be nice to have the ability to detect if the recording<BR>surface can be just replayed on the<BR>destination surface and it should not be too hard at least in trivial<BR>cases (currently paint and fill operations, when<BR>we add support for stroke-to-path, stroke ops, too).<BR>For example it would also be possible to do this kind of optimization<BR>for other operators, in particular OVER<BR>(it simply depends on the associativity of the operator).<BR></P>
<P>(HKBAIK) In addition to above scenario, it would be also helpful if the recording surface do not use the snapshot image. (I mean "disable snapshot mode" as metioned above.)</P>
<P> </P>
<P>><BR>> I also like to ask to review my source code patch to support above (1) and (2).<BR><BR>You forgot to attach/link the patch.</P>
<P>(HKBAIK) I am cleaning codes now, i'll share it soon. sorry for the confusion.</P>
<P><BR>Andrea<BR><BR>><BR>> Thank you very much.<BR>><BR>><BR>> Hyunki Baik<BR>><BR>> Senior Engineer<BR>> Samsung Electronics<BR>> --<BR>> cairo mailing list<BR>> cairo@cairographics.org<BR>> http://lists.cairographics.org/mailman/listinfo/cairo<BR>><BR><p>&nbsp;</p><p>&nbsp;</p>Hyunki Baik<BR><BR>Senior Engineer<BR>Samsung Electronics<BR><BR>MOBILE. 82-10-7557-0107</P><IMG style="DISPLAY: none" border=0 src="http://ext.samsung.net/mailcheck/SeenTimeChecker?do=49d54391e6acf7b9b55214a4e614e366ba120f24d84780d11aa3ee4d9bee60989d863d267dbfda2097b747f9fd0aa8f97978c4b304c8d0f1326bbdfb2ea96a2fcf878f9a26ce15a0" width=0 height=0>
<P> </P>
<P> </P>Hyunki Baik<BR><BR>Senior Engineer<BR>Samsung Electronics<BR><BR>MOBILE. 82-10-7557-0107
<P> </P>
<TABLE id=confidentialsignimg>
<TBODY>
<TR>
<TD NAMO_LOCK>
<P><IMG border=0 src="cid:Z5JE7EUABGFC@namo.co.kr" width=520></P></TD></TR></TBODY></TABLE></X-BODY></BODY></HTML><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=705252d897453316d0d46f5036528dfcd6a49eb3f50f4c4b0b100d3092ccb1646fddd309aee21a484345bb40c05b5d60f4bcdeced46ed5ee08cece8541bc14eacf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'>