Bug 463607

Summary: Swapping ttys while on optimus or prime nvidia laptop with external monitor causes screens to constantly swap
Product: [I don't know] kde Reporter: yizel7
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: RESOLVED DOWNSTREAM    
Severity: major CC: nate
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description yizel7 2022-12-30 01:09:18 UTC
SUMMARY
When changing ttys in kde plasma and you have an external monitor plugged in via hdmi and in Optimus mode using optimus manager. After you switch back to tty1 where you are normally logged in, the apps and windows will constantly switch without stopping. Apps are moving from the built in laptop screen to the external back and forth. The external monitor also flickers from black to drawing a portion of apps where you move your mouse.

I am not sure if this is a KDE Plasma bug, Nvidia driver bug, Linux kernel bug, sddm bug, X11/xorg bug, etc but i figured i would put it in the desktop environment ticket first  and then let you pros tell me if i am wrong and need to make it elsewhere. Thank you very much

STEPS TO REPRODUCE
1. Use optimus manager and put your laptop in GPU only mode
2. Plug in an external monitor via HDMI
3. Restart your laptop, login via sddm to KDE Plasma 5
4. Press ctrl+alt+F2 to F12
5. Change back to the logged in sddm KDE Plasma session with ctrl+alt+F1

OBSERVED RESULT
Whatever applications you have open will constantly be swapping between the built in laptop monitor and external monitor as well as flickering on external monitor.

EXPECTED RESULT
No flickering, applications swapping from screen to screen.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7
Kernel Version: 6.0.15-hardened1-1-hardened (64-bit)

ADDITIONAL INFORMATION
This issue might be fixed with the multimonitor rewrite. I am creating this ticket as awareness for now and will revisit when the multi monitor setup stuff is out.

related tickets to rewrite
https://bugs.kde.org/show_bug.cgi?id=463379
https://bugs.kde.org/show_bug.cgi?id=456210
https://bugs.kde.org/show_bug.cgi?id=437471
https://bugs.kde.org/show_bug.cgi?id=460341

maybe this would fix the issue but i cannot tell if the ticket commit has already been merged and released yet
https://bugs.kde.org/show_bug.cgi?id=456606
Comment 1 Nate Graham 2023-01-06 21:17:33 UTC
Pretty sure this is an Optimus bug as it tries to take control of the screen configuration and fights with KScreen. It shouldn't do that; graphics drivers don't have the necessary system integration to manage multi-screen arrangements.

Please report this issue to the NVIDIA folks, either by sending an email to linux-bugs@nvidia.com or making a post at https://forums.developer.nvidia.com/c/gpu-graphics/linux. It would be helpful to the NVIDIA developers if you could run nvidia-bug-report.sh and attach the resulting file in your report. Thanks!