Suttering during playback with plasma 6 / wayland and 24Hz refresh
Important Information
- mpv version = 0.37
- Linux Distribution and Version = Cachy OS x86_64_v4 repo and kernel 6.8.4-2-cachyos
- Window Manager and version = KDE / Plasma 6.0.3
- GPU model, driver and version = Radeon 6900XT, Ryzen 7800X3d, Mesa 24, Wayland
- vo=gpu-next
- gpu-api=vulkan
- hwdec=vulkan (but no or vaapi doesn't correct the issue)
I upgrade from Manjaro with Plasma 5 / X11 to CachyOS with Plasma 6 / Wayland. I never manage to get smooth video playback under Wayland / Plasma 6. There is random stuttering that appear mostly on scene change or slow moving scene. These stuttering are VERY random and could be barely noticeable to pretty heavy, and seems to have evolve during plasma / kwin update, for example setting target-peak=800 provoked heavy stuttering in plasma 6.0.0. The last few days i made some experimentation to investigate the problem. My use case i a little specific, i start mpv from kodi with the external player function and use a script (mpv-xrandr under X11 and mpv-kscreen-doctor under kwin/wayland) to set the refresh rate of my TV to match the video, then i use my TV's smooth motion. Most content will be of course ~24Hz.
I try a lot of mpv and kwin options and i don't find a solution, it's not related to VRR or HDR or hwdec etc.
I think the problem is related to 24Hz video playback : with the same mpv's configuration, there is no stuttering at 120Hz. I also report that enable video-sync=display-resample provoke heavy stuttering in 24Hz and some corruption. As i change my linux distribution for Cachy that have several differences and optimizations, i also try to run mpv in X11 (Mate or Kodi own session) to be sure and there is no issue, so i'm certain it's related to kwin / wayland.
Take a look, might be related: https://bugs.kde.org/show_bug.cgi?id=485917 https://bugs.kde.org/show_bug.cgi?id=485730
I just try again with kwin 6.0.4, there is still a lot of random stutter in 24Hz, it could be light in some video with random micro-stutter, or it could stutter to a point the video is unwatachable. I cannot be sure it's related to kwin as i don't use another wayland de. I try many option, including bare mpv.conf without any option or switching to vo=gpu instead of gpu-next, all without success. Maybe i should report this bug to kde directly instead of here ?
i've found that setting gpu-context=x11vk, instead of letting it default to gpu-context=waylandvk when running a wayland session of kde 6.0.5 dramatically increases performance, and gets rid of frame stuttering altogether
the issue stems from the waylandvk gpu-context not being able to hit the display's refresh rate.
rather unfortunate, given that mpv supports some nifty features for the wayland mode. it just can't reach the 119.88Hz of my display when it's set though :/ hopefully whatever is going on behind the scenes that is hurting the framerate (it dips down to 90Hz even, when waylandvk is turned on) gets resolved at some point. I'm running this on an RTX 3090 with an i9-13900k with a couple of custom shaders on, and hadn't had any issues with gpu-next and vulkan reaching my display's refresh rate until i tried out the waylandvk mode. (though, there were a number of other hurdles toward getting everything to play smoothly)
I got rid of this problem by setting video-sync=display-resample. But I also switched to an old NVIDIA GPU around the same time, so it might have been that.
I try again today with the recent update to Plasma 6.1. The problem is mostly gone, no more dropped frame and i saw very occasional stutter. After switching to video-sync=display-resample it seems there is no more stutter, video is now perfectly fluid. I close the issue.