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/ 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?


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.