Bug 479144 - Refresh rate becomes unstable in Wayland using freesync at 4k 120hz only after using fullscreen windows
Summary: Refresh rate becomes unstable in Wayland using freesync at 4k 120hz only afte...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.27.9
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 479222 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-12-29 07:42 UTC by swim
Modified: 2024-04-25 16:33 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description swim 2023-12-29 07:42:12 UTC
SUMMARY
I have tried to get freesync to work at 3840x2160 resolution, 120hz refresh rate, with adaptive sync set to 'Automatic' for gaming on a 65" LG OLED C3 but encounter the following issue: When booting and in the desktop environment the framerate indicates it is at 119fps with VRR/freesync ON via the LG 'game menu'. If I load a game via steam/proton at fullscreen (eg. Doom Eternal, Skyrim(either at capped 60fps or modded 120fps), Cyberpunk, Metro Exodus) it will function fine during game play, hovering around 119fps (or otherwise expected framerates depending on load or game).
The problem is, when I leave the game and return to desktop the framerate drops to 40-50fps and the screen exhibits a rather disorienting flicker. Reloading a fullscreen game does not return the frame rate to 119fps, the only way to stop the flicker/low frame rate is to change the refresh rate to something else, like 60Hz, and then back to 120Hz. At which point the framerate/vrr functions correctly.

This occurs using an 8k certified quality 2meter HDMI 2.1 cable, though the colors do not display correctly (this is an unrelated issue involving HDMI licenses and AMD).

Similar but slightly different things happen when using a Displayport to HDMI converter such as a CableMatters 102101-blk adapter or a ULT-WIIQ 2m dp to hdmi cable. With either of these, I can run in 4k 120hz resolution, with 4:4:4 color, and VRR ON(confirmed vrr function by running vrrtest). However, I can only play a game using borderless window mode. Full screen mode will work for a game, but once I leave the game the frame rate drops to 30-40fps and shows only a blank/black screen, unless I move the mouse around, then the framerate jumps back to 119fps and the issue can be reset by toggling the refresh rate out of 120hz and back again.

This scenario is particularly painful if I try and watch a movie with VLC media player in full screen. In a full screen movie the frame rate drops to 30-40hz and will go blank if I move the mouse at all. VLC does not appear to have a borederless window mode but the problem will not occur when maximized, so long as the normal menu trim is visible.

This does not occur at any refresh rate below 120hz such as 100, or 60hz at 3840x2160, nor does this occur at any refresh rate at 2560x1440(at this resolution, using an HDMI or DP adapter makes no difference). There are rather poor options with fixed refresh rates between 1440 and 2160 resolutions so it isn't worth testing. I did not bother with less than 1440p.

I have tried different cables and lengths to try and remove any signaling/bandwidth issue but the fact that I can boot into 4k120hz and have no issues using these frame rate, resolution, and VRR settings unless I enter then leave a full screen environment suggests it could be something in KDE that is not getting reset by this state change. I am aware of the issues around Linux and AMD's HDMI abilities but the fact this only seems to happen in this particular sequence has me thinking it isn't related.


STEPS TO REPRODUCE
1. Have AMD gpu and large format screen that sadly only has HDMI 2.1 ports, use suitable HDMI cable (install in gpu's eARC HDMI 2.1 port and tv eARC HDMI 2.1 port, or gpu's DP 1.4 port, to tv eARC HDMI 2.1 port with a converter).
2.  Set freesync on in tv settings. In PC set resolution to 3840x2160, refresh rate to 120hz, adaptive sync set to automatic
3.  Load game on full screen, observe actual framerate/VRR behavior
4. Quit game, return to desktop and observe framerate/VRR behavior 
5. In display settings change refresh rate to 60hz and apply, observe refresh rate locks to 59-60hz correctly, reset to 120hz refresh rate, observe refresh rate lock on to 119-120 correctly.
6. Repeat with either displayport to hdmi converters I mentioned and see similar results

OBSERVED RESULT
Refresh rate and freesync function correctly until leaving a fullscreen program, at which point the refresh rate drops to 30-40fps and a noticeable flickering occurs. When using a display port to hdmi adapter there is also a blank screen/black screen effect.


EXPECTED RESULT
it would be ideal to leave a full screen game and return to desktop with a stable refresh rate at the desired frequency while also enjoying freesync.


SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Debian Testing kernel 6.5.0.5-amd64
(available in About System)
KDE Plasma Version: 5.27.9
KDE Frameworks Version:  5.107.0
Qt Version: 5.15.10

ADDITIONAL INFORMATION
CPU: AMD 5800x3d
GPU: AMD 6900XT
TV: LG C3 65"
Comment 1 swim 2023-12-29 07:45:28 UTC
I forgot to mention, this issue does not occur at 4k120Hz in any configuration if I disable VRR/Freesync
Comment 2 David Edmundson 2024-01-02 11:26:12 UTC
*** Bug 479222 has been marked as a duplicate of this bug. ***
Comment 3 Gianandrea 2024-01-02 22:09:24 UTC
I have seen a similar issue to this when running KDE 6 - Beta 2 pulled from this COPR https://copr.fedorainfracloud.org/coprs/solopasha/kde6/ into my Fedora 39 system running Nvidia. I additionally have explicit sync patches applied for Xwayland and Wayland-protos as provided from the Nobara Project COPR.

I do not actually have this problem with KDE 5.27.10 (evertything else the same) only when switching to KDE 6 - Beta 2 as noted above. I haven't reported it as my setup was obviously not setup in an ideal fashion for testing. However I mention it as I have a similar setup with similar results when using Beta 2 in case it helps triangulate the issue. It might be revealing that it doesn't happen to me as an Nvidia user in 5.27.10 but does in 6 beta 2.

I tried enabling disabling other settings and these did not affect the issue. To note VRR does not enable as I run the DP to HDMI adapater due to bandwidth limitations on the HDMI port.

Issue:
"When using a display port to hdmi adapter there is also a blank screen/black screen effect."
For me the issue is actually only this element, but consistently if I have the resolution at 3840x1600 and 120hz. It mostly occurs when opening a new application, or opening the start bar. If I watch a video or do anything in an already open window I don't have an issue. Also games will run totally fine.

Hardware:
Nvidia 2080
Samsung QN90B set at ultrawide 3840x1600 - DP to HDMI 2.1 converter
Denon AVR-2500HX - HDMI for sound


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 39 6.6.0.5-amd64
(available in About System)
KDE Plasma Version: 5.91.0
KDE Frameworks Version:  Did not check before reverting
Qt Version: Did not check before reverting
Comment 4 Zamundaaa 2024-04-24 16:53:15 UTC
Can you still reproduce this on Plasma 6? If so, please attach the output of drm_info before, and after triggering the issue
Comment 5 Gianandrea 2024-04-25 05:52:03 UTC
For me this issue is now resolved.
Comment 6 Alexander Streng 2024-04-25 06:23:50 UTC
In my case I still have issues with freesync in Fedora 40 KDE Plasma 6.0.3 . I Tested freesync in Doom Eternal and in fight scenarios the fps would tank very badly if I had adaptive sync in either "automatic" or "always" mode. 

I have an Asus Tuf a16 advantage edition (2023) laptop which has a freesync display built-in.
Comment 7 Zamundaaa 2024-04-25 15:11:21 UTC
(In reply to Alexander Streng from comment #6)
> In my case I still have issues with freesync in Fedora 40 KDE Plasma 6.0.3 .
> I Tested freesync in Doom Eternal and in fight scenarios the fps would tank
> very badly if I had adaptive sync in either "automatic" or "always" mode. 
> 
> I have an Asus Tuf a16 advantage edition (2023) laptop which has a freesync
> display built-in.

Okay, that sounds like an unrelated issue; please make a new bug report for it
Comment 8 swim 2024-04-25 16:33:41 UTC
(In reply to Zamundaaa from comment #4)
> Can you still reproduce this on Plasma 6? If so, please attach the output of
> drm_info before, and after triggering the issue

I do not have this problem as I originally described it in kde 6. freesync does work with hdmi on full screen videos and games.

However, I am encountering the same resulting effect when waking the computer from sleep. At the login screen, the screen will flicker with freesync enabled or disabled only when I turn my monitor on and wake the pc(or wake up pc, turn monitor on). I cannot stop this without setting the refresh rate to 60 and then back to 120hz.

 I have not delved into it fully and assume its a separate issue. The only commonality between this report and my new problem is that this occurs only on 120hz refresh rate. Its almost like kde and the graphics card lock to an incorrect refresh rate right when the pc wakes up. Like the display has not had enough time to stabilize to 120hz before kde syncs to the output. This also does not happen when booting, which leads me to believe its something to do with kde.

As I said I have not had much time to look into it to make a formal bug report.