SUMMARY As soon as you disable AMS in KDE with KWIN_DRM_NO_AMS=1 VRR is broken in games when HDR is active. This is not the case when HDR is not active and AMS is disabled. This can be observed in different games, we used Cronos the new Dawn demo on steam STEPS TO REPRODUCE 1. Install Cronos: The New Dawn demo on steam 2. Make sure KWIN_DRM_NO_AMS=1 is set for KDE and enable HDR in KDE 3. Start the game with proton experimental OBSERVED RESULT - VRR does not work at all EXPECTED RESULT - VRR works SOFTWARE/OS VERSIONS Operating System: EndeavourOS KDE Plasma Version: 6.5.4 KDE Frameworks Version: 6.21.0 Qt Version: 6.10.1 Kernel Version: 6.19.0-rc4-273-tkg-eevdf (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 9800X3D 8-Core Processor Memory: 48 GiB of RAM (46.6 GiB usable) Graphics Processor: AMD Radeon RX 9070 XT ADDITIONAL INFORMATION - VRR works fine with AMS enabled + HDR enabled - VRR works fine with AMS enabled + HDR disabled - VRR works fine with AMS disabled + HDR disabled - The issues also happens on older kernels. - Mesa version doesn't matter, for the test i used: 25.3.3-1 - It happens when you play the game with proton experimental in xwayland and also happens if you play the game with proton-ge with winewayland. - You do not need to enable HDR in game for the issue to show up - We could confirm that issue also on a 7900XTX. Many thx !
The reason for this could be that KWin sets HDR metadata each frame. With legacy modesetting, setting any properties may cause the driver to do a pageflip, so if we set the property + then another frame, the driver might end up pushing two frames instead of one. There are some workarounds we can consider, like splitting out the code path for "allow_modeset" in KWin to a separate function, but as no actual legacy drivers support HDR, maybe the best course of action would be to just remove the feature from legacy. Looking at drmdb.emersion.fr, the same applies to VRR as well. Why are you using legacy in the first place though? It's "legacy" for a reason, it's not supposed to be used unless your driver doesn't support the proper API. I've considered ripping out the env var to force it as well...
(In reply to Zamundaaa from comment #1) > The reason for this could be that KWin sets HDR metadata each frame. With > legacy modesetting, setting any properties may cause the driver to do a > pageflip, so if we set the property + then another frame, the driver might > end up pushing two frames instead of one. > > There are some workarounds we can consider, like splitting out the code path > for "allow_modeset" in KWin to a separate function, but as no actual legacy > drivers support HDR, maybe the best course of action would be to just remove > the feature from legacy. Looking at drmdb.emersion.fr, the same applies to > VRR as well. > > Why are you using legacy in the first place though? It's "legacy" for a > reason, it's not supposed to be used unless your driver doesn't support the > proper API. I've considered ripping out the env var to force it as well... Hi, many thx for taking a look ! The reason is simple, it is that one : https://gitlab.freedesktop.org/drm/amd/-/issues/2950 Disabling AMS is the only way i am not plagued by crtc timeouts. And i am by far not the only one. So no matter what you plan to do, please do NOT REMOVE the KWIN_DRM_NO_AMS=1 option . I will simply go ahead and disable VRR when i enable HDR in the no ams usecase. Many thx ! Pingubot
How often does the pageflip timeout happen for you? If it is quite frequent only with atomic modesetting, I have a pretty small patch for KWin that might just help in the same way: https://invent.kde.org/-/snippets/3643 If you can verify that it helps, maybe we should ship it upstream.
(In reply to Zamundaaa from comment #3) > How often does the pageflip timeout happen for you? > If it is quite frequent only with atomic modesetting, I have a pretty small > patch for KWin that might just help in the same way: > https://invent.kde.org/-/snippets/3643 > If you can verify that it helps, maybe we should ship it upstream. Hi, its pretty random. Sometimes it happens twice or more a week, sometimes it doesn't happen for 2 weeks. So i just need to build kwin with that patch and see if i can completely get rid of the pageflips that way ? Many thx !
Yes. My theory for the difference is that amdgpu might be missing some locks or is otherwise not handling concurrent access 100% properly, so just not accessing it from two threads at the same time could make the pageflip timeouts as rare as with legacy modesetting.
(In reply to Zamundaaa from comment #5) > Yes. My theory for the difference is that amdgpu might be missing some locks > or is otherwise not handling concurrent access 100% properly, so just not > accessing it from two threads at the same time could make the pageflip > timeouts as rare as with legacy modesetting. Nice, i will give it a try with plasma 6.5.5 and report back ! FYI, i never had those pageflip timeouts while gaming, it only happens during desktop usage for me. And reading the bug report, it seems that disabling ams also helps to mitigate that issue when gnome is used.