mpv icon indicating copy to clipboard operation
mpv copied to clipboard

kwin Wayland: Unable to enable VRR on 0.35.0?

Open DonKatsu opened this issue 2 years ago • 13 comments

Important Information

Provide following Information:

  • mpv version: mpv 0.35.0
  • Linux Distribution and Version: Fedora 37 KDE
  • Source of the mpv binary: Fedora repo
  • If known which version of mpv introduced the problem: mpv 0.35.0
  • Window Manager and version: kwin 5.26.4 Wayland
  • GPU driver and version: mesa 22.2.3

Reproduction steps

My KDE's Adaptive Sync is set to Automatic. As of mpv 0.35.0 I assume I need to set drm-vrr-enabled=yes to enable Adaptive Sync, but it won't activate when mpv is fullscreened with it set. If I downgrade to mpv 0.34.1, fullscreen still activates Adaptive Sync Automatic, so I know my system has the capability.

I tried changing mpv's entry in /usr/share/drirc.d/00-mesa-defaults.conf to true as well, but that didn't help 0.35.0.

Additionally, I'm still experiencing the Display FPS issue of #10444. But even while mpv is reporting 60 there, my monitor OSD says it's running at 72hz (24fps source) with fullscreen 0.34.1. I included logs where I corrected for that issue before starting playback on both versions of mpv.

Expected behavior

Active Adaptive Sync on 0.35.0 with drm-vrr-enabled=yes?

Actual behavior

No Adaptive Sync despite drm-vrr-enabled=yes being set.

Log file

no-config_drm-vrr-enabled-yes_0-35-0.log no-config_drm-vrr-enabled-yes_0-35.0_corrected_display_fps.log no-config_0-34-1.log no-config_0-34.1_corrected_display_fps.log

DonKatsu avatar Dec 09 '22 05:12 DonKatsu

drm-vrr-enabled is not relevant for running mpv in Wayland/X11. I'm not familiar with the mechanisms that activate VRR under Wayland but I don't think there has been an intentional change since 0.34 here.

sfan5 avatar Dec 09 '22 09:12 sfan5

This is supposed to work as long as you aren't using display-resample or something similar. There's no actual specific code in mpv wayland that relates to vrr so I'm not sure what exactly would be different here but if you could bisect the commit that would be appreciated.

Dudemanguy avatar Dec 09 '22 14:12 Dudemanguy

Oh, I see. I don't know how to bisect. I tried compiling git again ~to at least see if it's an issue with Fedora's build of 0.35.0~. (Tried the flatpak of mpv 0.35.0 and got the same results.) But I still end up being unable to figure out which packages I'm missing that block me.

One more thing. Setting Adaptive Sync to Always, mpv 0.35.0 will activate it when playing a video either windowed or fullscreen. If besides that mesa config file there's a function of KDE/kwin that would specifically block mpv 0.35.0 from activating fullscreen VRR on Automatic, I'm not aware of it.

DonKatsu avatar Dec 09 '22 16:12 DonKatsu

So I suppose something in mpv changed that would break whatever kwin's heuristic is for Automatic since Always works. Wild guess but possibly the fact that we have multiple surfaces now (it confused GNOME in another issue)? I guess I can try myself later (this monitor allegedly has VRR although the range is kind of wimpy so it's not too useful).

Dudemanguy avatar Dec 09 '22 17:12 Dudemanguy

Intel Arc A770 user here. Have the same problem on archlinux wayland kde linux 6.4 drm next, the monitor is unable to change refresh rate, at stays it 144hz. But nothing nor Automatic nor Always in vrr settings works.

SopaDeMacaco-UmaDelicia avatar Jul 05 '23 23:07 SopaDeMacaco-UmaDelicia

If you're launching mpv from the terminal, try using --really-quiet. It turns out that merely painting stuff in the terminal causes plasma to break VRR.

As for the OP issue, now that I actually can get working VRR, I discovered what is breaking plasma's VRR detection. It's simply because mpv has multiple subsurfaces now. It would make sense why having multiple subsurfaces that render different things may break VRR, but most of the time mpv doesn't even use them. And even when we do use them, there's really no reason to not have it enabled. The two main surfaces that actually draw things are synced. There's technically one desync'd surface but literally all that happens is one 1x1 buffer is attached to it and it's never touched again. We could set that one to synced if it makes the compositor happier since it really doesn't matter, but it's simply having them made in the first place that causes the heuristic to break.

Dudemanguy avatar Jul 27 '23 23:07 Dudemanguy

Yeah, I was able to make vrr work, I had to minimize all apps, otherwise they will break vrr even in fullscreen mode for mpv.

SopaDeMacaco-UmaDelicia avatar Jul 28 '23 02:07 SopaDeMacaco-UmaDelicia

I can't seem to make VRR activate with mpv in fullscreen on wayland (KDE 5.27.9) either. I'm on Arch Linux kernel 6.5.8 with an RX 6650XT (amdgpu, mesa 23.2.1). Minimizing all other programs and trying different vo or hwdec doesn't help. I don't have display-resample enabled either. And mpv isn't listed in any /usr/share/drirc.d/*.conf file for me. Other fullscreen programs like vrrtest and games do activate VRR properly for me.

siroccal avatar Oct 26 '23 22:10 siroccal

You have to use --really-quiet (if launching from terminal) and set the VRR setting to Always in the plasma settings.

Dudemanguy avatar Oct 26 '23 22:10 Dudemanguy

You have to use --really-quiet (if launching from terminal) and set the VRR setting to Always in the plasma settings.

Thanks, but I didn't launch from a terminal and setting VRR to Always isn't a usable solution because that just forces VRR on for every single screen update even when using the desktop with non-fullscreen programs (which gives terrible brightness flickering with VA monitors).

siroccal avatar Oct 27 '23 00:10 siroccal

Well tell plasma to fix their automatic detection like I said above.

Dudemanguy avatar Oct 27 '23 02:10 Dudemanguy

Similar problems can be reproduced. sway and amdgpu. my monitor supports 100Hz with VRR, when I watch 60fps video with mpv, at window mode => monitor can sink at 60Hz. fullscreen => monitor stuck at 100Hz (and cause stutter)

yuiiio avatar Feb 08 '24 14:02 yuiiio

hm.. labwc doesn't have this issue. so maybe compositor(sway) issue. sorry

yuiiio avatar Feb 08 '24 14:02 yuiiio

With Plasma 6.0.1, my monitor OSD now shows that VRR is applying on content lower than the set refresh rate when MPV is full screen.

DonKatsu avatar Mar 06 '24 23:03 DonKatsu