batocera-linux / batocera.linux

batocera.linux
https://batocera.org
Other
1.93k stars 496 forks source link

[X86_64, Steam Deck][v39] VRR not working due to missing driver settings #12168

Open joerg-knitter opened 1 month ago

joerg-knitter commented 1 month ago

Batocera build version

v39 stable

Your architecture

X86_64, Steam Deck

Your Graphic Processor Unit(s) (GPU)

GeForce 3070, AMD APU

Issue description

Activating the VRR option does not change anything e.g. in RetroArch because VRR is disabled in the driver/X11 settings.

Detailed reproduction steps

Ensure that VRR is basically working with your graphics cards/monitor solution:

If you have Windows,

If you have a Steam Deck,

Batocera: Start Batocera either on your PC or your Steam Deck, enable VRR in ES or RetroArch itself (don´t know if a restart is required), and start one of the games above - you will see judder when the framerate does not match (Giana Sisters will of course work fine if you set the framerate to a fixed 50Hz, but if you leave it at the default 60Hz, you will see the judder).

Details of any attempts to fix this yourself

For the Steam Deck (AMD APU), add two additional lines to the 20-amdgpu.conf (also 20-radeon.conf?) in /etc/X11/xorg.conf.d, and VRR will be working after the next reboot of Batocera:

Section "OutputClass" Identifier "Fix AMD Tearing" Driver "amdgpu" MatchDriver "amdgpu" Option "TearFree" "true" Option "VariableRefresh" "1" Option "AsyncFlipSecondaries" "1" EndSection

I got this information from https://wiki.archlinux.org/title/Variable_refresh_rate.

However, with my PC/GeForce 3070 setup, I did not have luck: The world wide web said that that the parameter "AllowVRR" must be set using the nvidia-settings tool. I created a 99-nvidia.conf instead with the following content, but this did not work:

Section "Device" Identifier "nvidia" Option "AllowVRR" "True" EndSection

I also hoped to get it working by modifying the batocera-nvidia script in /usr/bin: if [ "$MODE" = "production" ]; then echo "Using NVIDIA Production driver - ${BATOCERA_NVIDIA_DRIVER_VERSION}" >> $log echo echo "blacklist nouveau" > /var/run/nvidia/modprobe/blacklist-nouveau.conf echo "options nvidia-drm modeset=1" > /var/run/nvidia/modprobe/nvidia-drm.conf echo "options nvidia-drm vrr=1" >> /var/run/nvidia/modprobe/nvidia-drm.conf

The log said something like "unknown option vrr".

So, even though my AMD setting seems to work (at least for Steam Decks connected via USB-C oder DP to the monitor), it still does not work on my nVidia PC.

Details of any modifications you have made to Batocera.

see above, modified 20-amdgpu.conf.

Logs and data

Background information / longer explanation on VRR:

Even though you can set a fixed monitor refresh rate in all OSes and within Batocera, this does not help with games changing the refresh rate or running at a non-standard (by today´s means) refresh rate.

There is also the simple use case that you don´t want to set the refresh rate for a specific system or game: With VRR enabled, I can set Batocera to 1080p60 but still can enjoy the C64 game “The Great Giana Sisters” at 50Hz because the monitor dynamically adapts the refresh rate to 50Hz. Or take “R-Type” on MAME with uncommon 55Hz or MS-DOS with a standard monitor refresh rate of 70Hz, besides of 3dfx parts running at 60Hz. A changing refresh rate can be seen e.g. with “BCKid” on the Amiga (downloadable at www.factor5.com; 50Hz at the beginning, but switching to 60Hz short after at the main intro and game) or “Tomb Raider 1” (currently “DOSBox Staging” only with VRR enabled; 70Hz during 2D scenes/videos, 60Hz in 3dfx scenes).

Compared to the former changes of refresh rates on monitors, VRR changes are dynamic and invisible, i.e. there is no “monitor mode changed” OSD message or black screens. It is generally meant to react to ever-changing refresh rates e.g. on modern shooter games with V-Sync disabled (that´s why 120Hz, 144Hz and 240Hz monitors exist nowadays).

For this to work, you either need a FreeSync (implementation of the VESA standard "AdaptiveSync") or G-Sync (proprietary; but with “G-Sync compatible” being compatible with FreeSync) monitor and an appropriate graphics card. Refer to https://www.amd.com/en/products/freesync-monitors or https://www.nvidia.com/en-us/geforce/products/g-sync-monitors/specs/ for a monitor overview. Note 1: FreeSync on GeForce cards only works on HDMI 2.1 monitors, if you have an HDMI 2.0 FreeSync monitor, use DisplayPort or USB-C instead! Furthermore, “G-Sync compatible” is supported by nVidia only starting with their GeForce 1xxxx range of cards. Note 2: MangoHUD (and “MSI Afterburner” on Windows) still reports the set fixed monitor refresh rate even though the monitor might run in VRR mode!

joerg-knitter commented 1 month ago

I don´t think - as discussed at discord - that this is a feature request because there is a menu entry in Batocera since v33 (https://forum.batocera.org/blog/7110-v33-blogpost) and a Wiki entry at https://wiki.batocera.org/latency_reduction_and_performance, furthermore at https://wiki.batocera.org/advanced_retroarch_settings#sync_to_exact_content_framerate_g-sync_freesync, but there is no word that it does not work at all at the moment without manual intervention.

Therefore, I would call it a bug because the ES menu entry would be obsolete as well as any other mentions of VRR in a Batocera context.

However, while the necessary adjustments for AMD might be clear at could be included in v40, there is no answer for Nvidia and Intel yet (not able to test Intel myself). And apparently, there is no support for VRR on Rasperrys, Odroids etc. (at least I read that FreeSync is not supported by Broadcom). But maybe it can at least be solved step-by-step.