<HTML><HEAD><TITLE>Samsung Enterprise Portal mySingle</TITLE>
<META content="text/html; charset=euc-kr" http-equiv=Content-Type>
<STYLE id=mysingle_style type=text/css>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>Thank you for reply.</P>
<P>Please see (HKBAIK) indications.</P>
<P>&nbsp;</P>
<P>Hyunki Baik<BR><BR>------- Original Message -------<BR>Sender : Andrea Canciani&lt;ranma42@gmail.com&gt; <BR>Date&nbsp;&nbsp; : 2011-05-27 14:41 (GMT+09:00)<BR>Title&nbsp; : Re: [cairo] Regarding performance and memory usage of the recording&nbsp;surface<BR><BR>On Fri, May 27, 2011 at 4:34 AM, ¹éÇö±â &lt;hyunki.baik@samsung.com&gt; wrote:<BR>&gt; Hello all,<BR>&gt;<BR>&gt; I have been testing the web-browser application which uses cairo recording surfaces.<BR>&gt; 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>&gt; 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>&gt;<BR>&gt; 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>&gt; 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>&gt; (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>&gt; In the experiment, up to 2x speedup can be observed.<BR>&gt;<BR>&gt; Based on that situation, I'd like to ask some questions.<BR>&gt;<BR>&gt; (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>&nbsp;</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>&gt; 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 (&amp;surface-&gt;base, image, NULL);" in _cairo_recording_surface_acquire_source_image() function&nbsp;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&nbsp;to allocate unlimited memory size for snapshot images from recording surfaces,&nbsp;I think it would be comvenient if some options about snapshot management are provided as below. </P>
<P>(1) manages all snapshot images for&nbsp;all recording surfaces</P>
<P>(2) do not&nbsp;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&nbsp;application or library&nbsp;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>&gt; (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.&nbsp;(I mean "disable snapshot mode" as metioned above.)</P>
<P>&nbsp;</P>
<P>&gt;<BR>&gt; 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)&nbsp;I am&nbsp;cleaning codes now, i'll share it soon. sorry for the confusion.</P>
<P><BR>Andrea<BR><BR>&gt;<BR>&gt; Thank you very much.<BR>&gt;<BR>&gt;<BR>&gt; Hyunki Baik<BR>&gt;<BR>&gt; Senior Engineer<BR>&gt; Samsung Electronics<BR>&gt; --<BR>&gt; cairo mailing list<BR>&gt; cairo@cairographics.org<BR>&gt; http://lists.cairographics.org/mailman/listinfo/cairo<BR>&gt;<BR>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;Hyunki Baik<BR><BR>Senior Engineer<BR>Samsung Electronics<BR><BR>MOBILE. 82-10-7557-0107</P></BODY></HTML><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=49d54391e6acf7b9b55214a4e614e366ba120f24d84780d11aa3ee4d9bee60989d863d267dbfda2097b747f9fd0aa8f97978c4b304c8d0f1326bbdfb2ea96a2fcf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'>