Bug 491916 - Monitor can't understand signal after closing or minimizing an adaptive sync application
Summary: Monitor can't understand signal after closing or minimizing an adaptive sync ...
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (other bugs)
Version First Reported In: 6.1.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-19 18:56 UTC by Wyatt Childers
Modified: 2024-09-14 04:02 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wyatt Childers 2024-08-19 18:56:10 UTC
SUMMARY
Applications that put the monitor into adaptive sync mode when using "Automatic" adaptive sync for a particular display can cause the monitor to be unable to interpret the signal.

STEPS TO REPRODUCE
1. Open an application in full screen with adaptive sync on
2. Close the application

OBSERVED RESULT
The application sometimes causes the monitor to report that the signal coming from the computer is unsupported.

EXPECTED RESULT
The monitor continues to receive a supported signal.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.10.4-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 7950X 16-Core Processor
Memory: 61.9 GiB of RAM
Graphics Processor: AMD Radeon RX 7900 XTX
Manufacturer: ASUS

ADDITIONAL INFORMATION
I think what's happening here is that the application adjusts the refresh rate to something like 93fps just before adaptive sync is switched off. Then kwin is still trying to run at 93 fps (but without adaptive sync) and the monitor goes "I don't know what to do with this."

I can (as a work around) fix this by changing the monitor refresh rate in settings using my second monitor (e.g. set the refresh rate to 60 from 120; it's then okay to change it back to 120, but changing it to a different value is all that's required to get things to "sync back up" and for my monitor to understand the input again).
Comment 1 Zamundaaa 2024-08-19 19:58:16 UTC
> I think what's happening here is that the application adjusts the refresh rate to something like 93fps just before adaptive sync is switched off. Then kwin is still trying to run at 93 fps (but without adaptive sync) and the monitor goes "I don't know what to do with this."
Sounds like a reasonable explanation, but KWin doesn't really change the refresh rate with vrr, the driver does that behind the scenes for us; KWin only decides whether or not it's allowed to do that.
Please report this at https://gitlab.freedesktop.org/drm/amd/-/issues
Comment 2 Wyatt Childers 2024-08-19 20:01:00 UTC
(In reply to Zamundaaa from comment #1)
> > I think what's happening here is that the application adjusts the refresh rate to something like 93fps just before adaptive sync is switched off. Then kwin is still trying to run at 93 fps (but without adaptive sync) and the monitor goes "I don't know what to do with this."
> Sounds like a reasonable explanation, but KWin doesn't really change the
> refresh rate with vrr, the driver does that behind the scenes for us; KWin
> only decides whether or not it's allowed to do that.
> Please report this at https://gitlab.freedesktop.org/drm/amd/-/issues

I'll do that, though I'll note, it might be worth kwin "resubmitting" the refresh rate after shutting off adaptive sync to work around buggy drivers (if that's something it can do).
Comment 3 Wyatt Childers 2024-08-19 20:13:17 UTC
Cross-linking to the upstream issue filed: https://gitlab.freedesktop.org/drm/amd/-/issues/3572.
Comment 4 Wyatt Childers 2024-09-04 00:57:23 UTC
@Zamundaaa is there any kind of kwin command line I can use to tell it to change the resolution after I close an application?

I'd like to wrap the application that's problematic in a bash script that just automatically sets the refresh rate to 60 and then back to 120 after the application closes so I don't have to keep doing it manually. It's a rather irritating process.
Comment 5 Zamundaaa 2024-09-05 12:23:54 UTC
Yes, you can use kscreen-doctor for that
Comment 6 Wyatt Childers 2024-09-05 15:32:47 UTC
(In reply to Zamundaaa from comment #5)
> Yes, you can use kscreen-doctor for that

Thanks; tested it out, that works flawlessly as a workaround!

If someone else comes across this, just change your game's launch options to:

%command% ; <your script path here>

Then edit the file to contain the resolutions things should be at (no need to toggle to something else first):

#!/usr/bin/bash
kscreen-doctor output.HDMI-A-1.mode.3840x2160@120
kscreen-doctor output.HDMI-A-2.mode.3840x2160@120

The script will run after the game exits and there might be a brief flicker (in this case on both monitors) but all will be well.
Comment 7 Wyatt Childers 2024-09-14 04:02:25 UTC
(In reply to Wyatt Childers from comment #6)
> (In reply to Zamundaaa from comment #5)
> > Yes, you can use kscreen-doctor for that
> 
> Thanks; tested it out, that works flawlessly as a workaround!
> 
> If someone else comes across this, just change your game's launch options to:
> 
> %command% ; <your script path here>
> 
> Then edit the file to contain the resolutions things should be at (no need
> to toggle to something else first):
> 
> #!/usr/bin/bash
> kscreen-doctor output.HDMI-A-1.mode.3840x2160@120
> kscreen-doctor output.HDMI-A-2.mode.3840x2160@120
> 
> The script will run after the game exits and there might be a brief flicker
> (in this case on both monitors) but all will be well.

Upon extended testing, this did not work consistently and would sometimes result in a screen "flipping" every couple of seconds between what was supposed to be shown and a black screen.

HOWEVER, I switched to a DisplayPort cable and that has worked without a problem ... so that's my new recommendation for anyone stumbling in here.