Automatically change refresh rate on Wayland: Possible?

Hi there!

I use the Vulkan backend on Wayland, and I would like to convince RetroArch to automatically set a custom refresh rate for the VirtualBoy core, which is a 50Hz system. I use HDMI: no CRT or analog connections for me.

Now, to get a temporary 50Hz mode I have to do:

wlr-randr --output HDMI-A-1 --mode 1280x720@50
retroarch -L ~/.config/retroarch/cores/mednafen_vb_libretro.so vb/wario.vb
wlr-randr --output HDMI-A-1 --mode 1280x720@60

…and also have this override on the on VB core override:

video_refresh_rate = "50.005001"

(Note that this refresh rate was detected by RetroArch while the temporary 50Hz mode was set on the system).

This way, I get PERFECT Virtual Boy 50Hz emulation with smooth scrolling.

Now, is it possible to tell RetroArch to set a refresh rate using overrides, etc? video_refresh_rate does NOT set a refresh rate: it’s for telling RA the physical refresh rate set on the video output, not for setting one. There are those crt_* options, which I don’t think are of any use for this.

I could create a Wayland custom video mode, like 1280x721@50, and use these overrides for the core to force the 50Hz mode: video_fullscreen_x=1280 video_fullscreen_y=721

…But that would be a very clunky solution: setting a custom refresh rate on Wayland is possible and very easy: can RetroArch do it on this day and age?

Thanks!

Also, I would like to note that I have video_autoswitch_refresh_rate = "1" in retroarch.cfg, which should make VirtualBoy core switch the refresh rate for me since it’s a 50Hz system, shouldn’t it?

Replying to myself: video_autoswitch_refresh_rate = "1" works great on KMS/DRM, but not on Wayland!

So that’s the problem: video_autoswitch_refresh_rate doesn’t do anything on the Wayland backend.

Should it be working, or is RetroArch lacking the code for it to work on Wayland??

Also, using Vulkan that option doesn’t do anything on KMS/DRM… :frowning:

Just saw the message on Discord, and this thread came up in the search :slight_smile: Unfortunately, Wayland is not designed to allow this. It may be possible eventually to do it, using wlr-output-management-unstable-v1 protocols. Vulkan+KMS also do not support automatic refresh rate switch. I started out some time ago to improve that, but only got as far as supporting a fixed custom refresh rate.

Is it not possible for you to use VRR? That would fix your problem.

The vast majority of films are 24fps which is outside the range of VRR. Lack of automatic refresh rate switching basically disqualifies Linux desktop as an option for videophiles.

films will not benefit from vrr anyway as it was designed with games in mind

Not really, since 24*2 is already in range, but yeah, wayland: grrr.

I am on Linux and some applications besides games and emulators, like VLC and Opera support Gsync monitors. Indicator appears too (flip, vsync green and gsync green). Am not sure about Freesync and VRR as I have only Gsync. Currently I am on lxqt as it has the best gsync support unlike the other managers as both MAME and Retroarch work.

Only problem is that on Firefox there is tearing on YT videos. You have to use another manager or enable force composition. But when Opera plays YT videos, Gsync is activated and there is no screen tearing, unlike Firefox. This saves me from enabling force composition pipeline. On VLC though if videos are encoded in 10bit, Gsync is not activated. Monitor range is 30-100 hz too so this takes advantage of PAL games

I hear people deriding Wayland, while others welcome it with arms wide open. Basically, what’s the deal with it? I’ve been only using X11 until now, but things seem fine at my end. Is Wayland good or bad? Or, like most things, it has its own usecase and only works fine for that?

when it comes to Retroarch and MAME, Wayland does not make any difference, especially in arcade games, as it does not synchronise with the exact framerate. For non - 60hz arcades while there is no tearing, motion is not smooth. It is good only for reducing tearing in general applications and 3d games.

Also it is still marred with issues. Add also that it does not support older gpus. In my case, on Pascal Nvidia it is not possible to add VRR option to Gnome display settings. While application compatibility still leaves a lot to be desired. Some do not run at all, while others (eg Ryujinx emulator) do not display image under Wayland if you pick Vulkan.

The huge promotion comes from fps players that comprise the most vocal majority

1 Like

Thank you for your answer. I imagine it’s worse for emulation in general then. Luckily, there’s still some relevant distros supporting X11 for a while. I hope Wayland fixes its issue when the time for change comes.

1 Like