← Back to team overview

kicad-developers team mailing list archive

GAL FPS Limiting

 

Hi all,

I was looking why panning in GAL canvas on OS X is sometimes very jerky.

I found out that GAL implements a framerate limiting using a timer, which blocks further updates if you try to refresh with >60Hz.
With a Mac touchpad you easily get scroll events >60Hz, so that hits quite often.

Problem is, that the timer event to unblock again at least on my MacBook often needs between 200ms and 500ms instead of the max. 17ms it should have. If this happens, you get “hangs” while panning.

I tried to throttle mouse events to <60Hz to avoid hitting the timer.
Unfortunately, this doesn’t seem to be enough, because EDA_DRAW_PANEL_GAL::Refresh still seems to be called very frequently (<<17ms, often with a delta of 0ms or 1ms). So, timer still kicks in and blocks things more than needed.
I also did notice that EDA_DRAW_PANEL_GAL::Refresh is called on every mouse move (with default system mouse cursor)… is that also intended? For updating status bar?

Any ideas on either how to improve the timer or how not to make it kick in?

I already did try to use the wxTimer::Notify() function instead of having a wxTimerEvent delivered, but that didn’t make any big difference.
I didn’t investigate the timer implementation of wxWidgets on OS X, maybe the latency already is there before any wxWidget event handling.

Or, wouldn’t it be more appropriate to use something like the vertical sync 
  https://www.opengl.org/wiki/Swap_Interval <https://www.opengl.org/wiki/Swap_Interval>
to limit drawing instead of this timer?


Regards,
Bernhard



Follow ups