TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.2k stars 385 forks source link

Bizhawk audio crackles/suffers severe performance loss while minimized #3008

Closed Nicholas-Steel closed 5 months ago

Nicholas-Steel commented 2 years ago

It looks like minimizing Bizhawk while playing an N64 game causes what seems to be a severe performance issue for the emulator with the audio buffer sounding severely starved/crackly.

Minimizing the emulator via the Minimize button, the "Show desktop" button on the taskbar or double-clicking the application on the taskbar to minimize it all cause this issue. Switching to another program without minimizing Bizhawk is fine.

Windows 10 21H2 Geforce 1070Ti Realtek ALC1220 audio Direct3D, Vsync Enabled config.txt

split from #1279

zeromus commented 2 years ago

no problem here for me. maybe your os power or GPU configuration is set to snooze minimized windows and the GPU rendering can't keep up. Trying a demanding core (bsnes or octoshock) that doesnt have gpu acceleration would help prove that

Nicholas-Steel commented 2 years ago

Assuming you haven't tried the included configuration file or the file I included doesn't contain all settings:

Disable Clock, Audio and Vsync Throttle. Enable Vsync (My display is 60Hz) Direct3D graphics API

Minimize the emulator.

zeromus commented 2 years ago

no problems for me here on windows 7. What about the "some kinda power saving" thing? I can't observe any reduction of the CPU speed on my 5950x with it minimized, even when I pin it to two cores so that I'm sure which two to watch.

Nicholas-Steel commented 2 years ago

no problems for me here on windows 7. What about the "some kinda power saving" thing? I can't observe any reduction of the CPU speed on my 5950x with it minimized, even when I pin it to two cores so that I'm sure which two to watch.

I'm not sure what the cause is, only that I can reliably reproduce it. I think my ramblings about power settings were misleading and should be disregarded. I can make a video clip of the issue if you'd like?

zeromus commented 2 years ago

We need reproductions from other users, since the simplest explanation is still your system being misconfigured to inappropriately snooze minimized windows

Nicholas-Steel commented 2 years ago

It's only when using the Direct3D graphics API with the Vsync setting enabled. If I switch to OpenGL or turn off the Vsync setting the problem ceases to happen.

I've also tried setting this to Background Programs in an attempt to resolve it: image

Edit: Setting Bizhawk to have no Window Frame will prevent the issue from happening when clicking Show Desktop on the taskbar, it'll still happen if you use Task Manager to minimize Bizhawk though.

Morilli commented 2 years ago

Can reproduce. While I try to figure this out, I can recommend

  1. not using vsync if it doesn't work
  2. not minimizing the window lol or
  3. using alt+esc instead
Morilli commented 2 years ago

First google result: https://www.gamedev.net/forums/topic/641298-directx-window-drops-to-30fps-when-it-is-not-the-foreground-window-in-win7/

Seems this is not a bizhawk problem, and especially not a new problem. It may be the nvidia drivers or whatever intentionally throttling a background window, assuming that its fps are not crucial (which they wouldn't be, weren't fps directly tied to audio and game speed in emulation). Profiling also shows suspiciously large render times: image

The best approach here is probably to force-disable vsync on minimize or call this intended behavior.

YoshiRulz commented 2 years ago

What happens if you enable MainForm.InvisibleEmulation while minimised?

Morilli commented 2 years ago

What happens if you enable MainForm.InvisibleEmulation while minimised?

Does not seem to work. Setting display mode to "absolute zero" does maintain 60fps though.

zeromus commented 2 years ago

Forcing the logic internally to "absolute zero" while minimized is a good idea. I endorse this if anyone wants to take a stab at it

Morilli commented 5 months ago

This should be resolved in the latest dev version since the upgrade to Direct3D11.

CasualPokePlayer commented 5 months ago

Regardless of D3D11 it would have been solved just due to 3c168ed64cf28dce7da81ab39f3e43e5f4034658 skipping all rendering work while minimized.