schellingb / dosbox-pure

DOSBox Pure is a new fork of DOSBox built for RetroArch/Libretro aiming for simplicity and ease of use.
GNU General Public License v2.0
731 stars 61 forks source link

VRR, BFI and other related refresh rate issues with DOSBox Pure #474

Open PoloniumRain opened 4 months ago

PoloniumRain commented 4 months ago

This is a pretty complex subject so i'll try my best to explain it.

So when RetroArch's Black Frame Insertion feature is enabled it looks like this...

https://github.com/schellingb/dosbox-pure/assets/50634894/cf9ec1ea-5fb4-40b0-92ba-db97dc5e03b5

This flickering is caused by the 70Hz/70fps refresh rate output of DOSBox Pure. So not only does this cause screen tearing/stuttering when a games frame rate doesn't exactly match this refresh rate, it also causes severe BFI flicker.

On my 120Hz VRR/G-Sync TV the problem can be fixed with the Core Option 'Force 60 FPS Output' being as 60fps is half of that refresh rate, so the BFI matches up perfectly (so 140Hz BFI would work with 70fps but RA doesn't support this).

Forcing the core to output 60fps introduces another problem though, where obvious stuttering appears in games that don't run at 30 or 60fps, which is most DOS games (Doom is 35fps for example because it's half of 70Hz, which many monitors used at the time). As it is right now the Force 60 FPS option isn't very useful.

It all comes down to this: To get rid of the BFI flicker the forced output needs to be the same as the displays refresh rate, or 1/2 or 1/4. To get rid of stuttering on a VRR display the game needs to run at the same frame rate as the forced output, or half of that.

So could you please add more forced output options instead of just 60? It's best to allow for fine control with increments of 1 so it will basically cover every display and game out there. Some monitors now go up 560Hz but having options up to 240 should be enough (if this is even possible to do with DOSBox). Any displays that have a higher refresh rate could just use any evenly divisible number. If it's not possible to go over 70Hz due to how DOSBox works then settings from around 20 - 70 would still be great to have.

This should (hopefully!) fix 3 different problems:

  1. Setting the forced output to match a games frame rate should fix stuttering/frame pacing issues on VRR displays.
  2. Fixes screen tearing on VRR displays.
  3. Fixes BFI flickering.

If the display isn't capable of VRR then the first 2 would still be of some benefit. For example, if a game were to run at 75fps you could set both the forced output and the monitor to 75Hz.

Ideally it would be best if DBP could output the same refresh rate as the games frame rate so that it will automatically work with VRR, but this will be DOSBox related and likely not easily done (think you've mentioned this before as well). So for now, if fine control of the forced output option was implemented, then each game could be configured with its own forced output setting.

tails101 commented 3 months ago

Well RetroArch need to add 140hz and 150hz support. Or a vrr support mode for black frame insertion since it use fixed frequency not supported by the game to work for the moment.