On Windows we see high CPU utilisation due to vblank handling when monitor is off (laptop lid is closed with do nothing set in power option).
Is there anything that we can do in the application code to prevent VBlankThread from calling onVBlank when the monitor is off.
I’m afraid not.
I wonder if you could reduce the CPU utilisation by adding a conditional to your repaint()
calls, or functions inside onVBlank
that only executes the call if the monitor isn’t off.
You may also have to use the Windows API directly to detect if the monitor is off?
This is something we may provide support for, but I’m also curious if you can improve the situation in this way.
I could confirm that the repaint() calls in our application code is not getting called when the monitor is off and CPU utilisation is high.
I see that VBlankThread::run() to HWNDComponentPeer::onVBlank() code path seems to be consuming a lot of CPU cycles. Is this expected? Is it possible to avoid this when monitor is off.
A fix has been released on develop
. This should limit the CPU usage by imposing a 1000 Hz upper limit to the refresh rate. Admittedly this could be improved, but this can significantly reduce CPU usage, and is the same workaround that is currently used by Chrome.