[cairo] Cairo + GTK animation - high Xorg load

David J. Herzfeld herzfeldd at gmail.com
Wed Oct 26 19:51:32 UTC 2016

Hi All -

I have written an application in GTK+(3.18.9-1, standard C on Fedora 
23) with includes a number of "real time" scrolling graph widgets (like 
an oscilloscope). As recommended on the cairo animation tutorial pages, 
it uses gtk_widget_queue_draw() with a timer to update the graphs.

The application probably has ~10 graphs at any given time.

The gtk redraw function for the graphing widgets is pretty 
straightforward and completes in very little time. However, as the 
number of widgets increases (or as the widgets are expanded to full 
screen), the Xorg process begins to hog all of the CPU. With multiple 
fullscreen widgets across multiple monitors, the slowdown is quite 

I've created a simplified working example at 
<http://pastebin.com/in17XGjs>. Under normal conditions, on my system, 
the load of Xorg is ~5%. With just one full screen widget, this load 
balloons to nearly 30%. With two fullscreen widgets, the load is even 

Is this load normal? Is there a way to reduce it? Normally, I would 
reduce the load by invalidating a small region rather than the whole 
widget, but since the graph is scrolling, the whole thing needs to be 

Should I be using a different cairo backend (although everything still 
has to sit inside of a GTK widget)?

In my naive mind, playing multiple fullscreen movies simultaneously 
shows almost no increased load on my system, yet these simple widgets 
have a giant load...I must be doing something wrong...

Any help is appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20161026/1948fd77/attachment.html>

More information about the cairo mailing list