<div class="gmail_quote">On 20 March 2012 11:32, Chris Wilson <span dir="ltr"><<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>></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 <<a href="mailto:csotiriou@gmail.com">csotiriou@gmail.com</a>> wrote:<br>
> On 19 March 2012 20:27, Chris Wilson <<a href="mailto:chris@chris-wilson.co.uk">chris@chris-wilson.co.uk</a>> wrote:<br>
</div><div class="im">> > The truly puzzling part for me is that they seem viable candidates to<br>
> > hit the fast-paths, yet end up in the general polygon code.<br>
> ><br>
> > << /content //COLOR_ALPHA /width 500 /height 500 >> surface context<br>
> > n 22.726562 22.726562 454.546875 454.546875 rectangle<br>
> > 0 0.65 1 rgb set-source<br>
> > 0.295602 0.913843 scale<br>
> > 3.655372 set-line-width<br>
> > stroke+<br>
> > pop<br>
> ><br>
> > Oh, I see. A non-uniform, non-integer scale factor. That would explain<br>
> > it. Let's see if I can cook up something faster for you.<br>
> ><br>
><br>
> I can round the scaling factor for the cairo_scale() function call; would<br>
> that make a big performance difference?<br>
<br>
</div>I'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 "double-buffering", </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 "you already fixed the fast-path to catch this case as well", 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>