<br>On Thu, Oct 27, 2016 at 6:56 AM, Stefan Salewski <mail@ssalewski.de> wrote:<br><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">I think that drawing 1000 lines with 60 Hz in fullscreen mode is indeed
a high load for Cairo.</div></blockquote><div><br></div><div>Actually, it's only 1000 points on a single line, not 1000 lines. So, I figures this is pretty simplistic, and should have a relatively low load.</div><div><br></div><div>I timed out the draw function <<a href="http://pastebin.com/0m0PF9Xc">http://pastebin.com/0m0PF9Xc</a>>. On my system, fullscreen, draw takes only 0.50ms (so a theoretical maximum frame rate of ~2kHz). So very low execution time in my written function, but Xorg still uses 30% of the CPU. I have a feeling it's not my drawing, but the interaction Cairo with the backend after draw() returns.</div><br><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">
What you can do is of course: Shift the already drawn curve to the left
and draw only the new part. Cairo offers fast routines for copying
areas, so for that case cpu load should be really low. For the trivial
case of a plain sine wave, you can even draw the size extended curve to
a backup area and then just copy the desired area to your window, so no
drawing is necessary at all. That is what I did for my schematics
editor for the background grid. (Of course complete redraw is easier,
and when copying areas there is a minimal risk that you can get
artefacts at the borders of old and new area.)</div></blockquote><div><br></div><div>I agree completely. There's many strategies that I could use to speed the actual draw call up. What I actually do in my program is draw to a buffer, and then in the draw function, just call cairo_set_source_surface(). </div><div><br></div><div>I've updated the example again, to use exactly this model <<a href="http://pastebin.com/apaFiGyd">http://pastebin.com/apaFiGyd</a>>. Here, the Xorg load is decreased somewhat (at the expense of increased load for the actual application), but Xorg load is still ~15% and scales with the size of the window. I don't understand this - I've already done all of the necessary drawing work in the thread. I could understand if the thread load increased with the size of the surface (which it does not appear to), but why should Xorg's? Essentially I want to say - here is this pixel buffer - just display it as is. Perhaps this is too simplistic an understanding of how Cairo is interacting with the display system.</div><div><br></div><div>Any pointers would be appreciated.</div><div><br></div><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">
Other backends: As far as I know there is no hope for much speedup when
using the not well supported opengl backend</div></blockquote><div><br></div>Thanks! I figured it was worth asking. <div><br></div><div>Thanks again for all of your help!</div><div><div><br></div></div>