libretro-mirrors / beetle-saturn-libretro

Standalone port of Mednafen Saturn to the libretro API.
GNU General Public License v2.0
62 stars 42 forks source link

Backport VDP2 render thread 'busy wait' performance fix #191

Closed jdgleaver closed 3 years ago

jdgleaver commented 3 years ago

At present, the core uses 100% of one CPU core even when the runloop is paused. This is because the VDP2 rendering happens on a secondary thread which spends almost all of its time spinning in a busy wait loop.

This PR (trivially) backports the updated VDP2 thread handling method from upstream. Now the thread will only wake up to process events for the current frame - in between frames (and when the runloop is suspended by the frontend), it will be correctly 'paused'. This significantly reduces CPU usage.

Closes #188

Tatsuya79 commented 3 years ago

Blast Wind crashes when starting a game after the title screen since this commit on win x64.

That game is working in latest stand-alone 1.27.0.

Sanaki commented 3 years ago

Can confirm similar behavior on Linux x86_64, though it's a hard freeze rather than a crash here. I didn't test the prior commit to verify it worked previously myself, since you already did so.

jdgleaver commented 3 years ago

This should fix the issue: #199