Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joerg-knitter opened this issue Jul 29, 2024 · 1 comment

Comments

@joerg-knitter
Copy link

joerg-knitter commented Jul 29, 2024

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,

  • connect your system best with a DisplayPort or USB-C cable to an VRR capable monitor (e.g. FreeSync, G-Sync). If you have an AMD graphics card, HDMI 2.0a might also be sufficient, if you have a GeForce 1xxxx and newer, you need DisplayPort, USB-C or HDMI 2.1.
  • install RetroArch, enable G-Sync/FreeSync in the driver settings and setup RetroArch with the following settings:
    Vertical Sync (V-Sync): ON // V-Sync Swap Interval: Auto // Black Frame Insertion: OFF // Maximum Swap-chain Images: 3 // Frame Delay (ms): 0 // Automatic Frame Delay: OFF // Sync to Exact Content Frame-rate (G-Sync, Free-Sync): ON
  • Then set the refresh rate e.g. to 60Hz
  • Start e.g. the following games and take care if the scrolling is completely smooth: Giana Sisters (C64, 50Hz), R-Type (MAME, 55Hz), BCKid (Amiga, starting with 50Hz, followed by 60Hz; www.factor5.com)

If you have a Steam Deck,

  • Connect the Steam Deck via USB-C directly to a VRR monitor
  • Install RetroArch in desktop mode from Flatpak (Discover tool)
  • Enable VRR in RetroArch as mentioned above
  • Enable VRR in the Steam Deck´s settings, disable frame limit
  • Start RetroArch in Desktop Mode and take care if the scrolling is completely smooth in the games mentioned above

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
Copy link
Author

joerg-knitter commented Jul 30, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants