2011/6/3 Á¶¿µÈ¯ <span dir="ltr">&lt;<a href="mailto:yhwan.cho@samsung.com">yhwan.cho@samsung.com</a>&gt;</span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">




<div>
<p>Hello.</p>
<p>&nbsp;</p>
<p>It&#39;s delivering patch.</p>
<p>&nbsp;</p>
<p>I&#39;m younghwan working with HKBAIK on this issue.</p>
<p>&nbsp;</p>
<p>please see and review the patch file attached.</p></div></div></div></blockquote><div><br>I believe that the change in cairo-image-surface.c is incorrect.<br>How is it supposed to handle the various repeat modes?<br><br>
The change in cairo-surface-snapshot.c&nbsp; seems correct. I wonder<br>if it would be better to limit the (total) size of snapshots or doing<br>some similar trick to avoid replaying the snapshot multiple times<br>when using it more than once as a source.<br>
<br>It should also be noted that the current way of creating the<br>snapshot is incorrect, as pointed out in this bugreport:<br><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30282">https://bugs.freedesktop.org/show_bug.cgi?id=30282</a><br>
<br>Fixing this bug will make reusing the old snapshot less likely,<br>so something like the no-snapshot approach you suggest might<br>become the default.<br><br>Andrea<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div class="h5"><div>
<p>&nbsp;</p>
<p>Younghwan.</p>
<p>&nbsp;</p>
<p>------- <b>Original Message</b> -------</p>
<p><b>Sender</b> : ¹éÇö±â&lt;<a href="mailto:hyunki.baik@samsung.com" target="_blank">hyunki.baik@samsung.com</a>&gt; 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>&nbsp;</p>

<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;<a href="mailto:ranma42@gmail.com" target="_blank">ranma42@gmail.com</a>&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;<a href="mailto:hyunki.baik@samsung.com" target="_blank">hyunki.baik@samsung.com</a>&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&#39;d like to ask some questions.<br>&gt;<br>&gt; (1) Do you have a plan to support &quot;disable snapshot mode&quot; for the recording surface? (by parameter when recording surface is created or by build option)<br>
<br>I&#39;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 &quot;_cairo_surface_attach_snapshot (&amp;surface-&gt;base, image, NULL);&quot; in _cairo_recording_surface_acquire_source_image() function&nbsp;in cairo-recording-surface.c file, it doesn&#39;t take a large memory any more even if it doesn&#39;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 &quot;direct replay mode&quot; 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 &quot;direct replay mode&quot; 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 &quot;disable snapshot mode&quot; 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&#39;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; <a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
&gt; <a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><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><img src="" border="0" height="0" width="0"> 
<p>&nbsp;</p>
<p>&nbsp;</p>Hyunki Baik<br><br>Senior Engineer<br>Samsung Electronics<br><br>MOBILE. 82-10-7557-0107 
<p>&nbsp;</p>
<table>
<tbody>
<tr>
<td>
<p><img src="cid:Z5JE7EUABGFC@namo.co.kr" border="0" width="520"></p></td></tr></tbody></table></div><img src="" border="0" height="0" width="0"></div></div></blockquote></div><br>