<div class="gmail_quote">On 20 March 2012 11:32, Chris Wilson <span dir="ltr">&lt;<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, 20 Mar 2012 09:42:19 +0200, Christos Sotiriou &lt;<a href="mailto:csotiriou@gmail.com">csotiriou@gmail.com</a>&gt; wrote:<br>
&gt; On 19 March 2012 20:27, Chris Wilson &lt;<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>&gt; wrote:<br>
</div><div class="im">&gt; &gt; The truly puzzling part for me is that they seem viable candidates to<br>
&gt; &gt; hit the fast-paths, yet end up in the general polygon code.<br>
&gt; &gt;<br>
&gt; &gt;  &lt;&lt; /content //COLOR_ALPHA /width 500 /height 500 &gt;&gt; surface context<br>
&gt; &gt; n 22.726562 22.726562 454.546875 454.546875 rectangle<br>
&gt; &gt; 0 0.65 1 rgb set-source<br>
&gt; &gt; 0.295602 0.913843 scale<br>
&gt; &gt; 3.655372 set-line-width<br>
&gt; &gt; stroke+<br>
&gt; &gt; pop<br>
&gt; &gt;<br>
&gt; &gt; Oh, I see. A non-uniform, non-integer scale factor. That would explain<br>
&gt; &gt; it. Let&#39;s see if I can cook up something faster for you.<br>
&gt; &gt;<br>
&gt;<br>
&gt; I can round the scaling factor for the cairo_scale() function call; would<br>
&gt; that make a big performance difference?<br>
<br>
</div>I&#39;ve already fixed the fast-path to catch this case as well. The other<br>
thing worth asking about is that in the trace you use an image surface<br>
for your rendering. Is this a deliberate change from earlier? For the<br>
rendering you are performing, with a good driver, all the overhead will<br>
be in cairo converting the strokes into geometry, though I suspect<br>
the transfer of the image will be smaller than all the geometry. With<br>
cairo-1.12, you may like to use cairo_surface_create_similar_image()<br>
instead, as that opens up the possibilities of doing zero-copy uploads.<br></blockquote></div><span style="color:rgb(0,51,51)"></span><br style="color:rgb(0,51,51)"><span style="color:rgb(0,153,0)">I tried two approaches for &quot;double-buffering&quot;, </span><br style="color:rgb(0,153,0)">
<br style="color:rgb(0,153,0)"><span style="color:rgb(0,153,0)">(1) using an image surface, </span><br style="color:rgb(0,153,0)"><span style="color:rgb(0,153,0)">(2) using cairo_surface_create_similar(), as I read in the mailing lists, that it achieved better performance. </span><br style="color:rgb(0,153,0)">
<br style="color:rgb(0,153,0)"><span style="color:rgb(0,153,0)">I actually found that (1) is faster, surprisingly enough! This is what worried me in the first place with respect to 2D performance.</span><br style="color:rgb(0,153,0)">
<br style="color:rgb(0,153,0)"><span style="color:rgb(0,153,0)">When you say that &quot;you already fixed the fast-path to catch this case as well&quot;, I guess you mean that this change will be included in the next Cairo version, correct?</span><br style="color:rgb(0,153,0)">
<br style="color:rgb(0,153,0)"><span style="color:rgb(0,153,0)">Hence, for the current version I guess the only suggestion for increasing performance, based on my existing cairo rendering implementation, is to round the scaling to an integer, is that right?  </span><br style="color:rgb(0,153,0)">
<br style="color:rgb(0,153,0)"><span style="color:rgb(0,153,0)">Thanks again for your time,</span><br style="color:rgb(0,153,0)"><br style="color:rgb(0,153,0)"><span style="color:rgb(0,153,0)">Christos.</span><br style="color:rgb(0,153,0)">
<br style="color:rgb(0,153,0)"><span style="color:rgb(0,153,0)">P.S. a quick and related question on suface copying for increasing performance - if I draw on a large image surface, say 2000x2000, and then use cairo_set_source_surface() to copy this surface to a smaller one, say 200x200, is the expected behaviour for cairo_set_source_surface() to automatically shrink and map the original image (map) to the target, smaller surface? </span><br clear="all">
<br>-- <br>--------------------------------------------------------------------------<br>Christos P. Sotiriou<br>email: <a href="mailto:csotiriou@gmail.com">csotiriou@gmail.com</a><br>Cell: +30 697 8984 222<br>