Bug 396354

Summary: Management of multiple screens: Display and Monitor settings no longer remembered
Product: [Plasma] KScreen Reporter: bugreporter11
Component: commonAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: bugreporter11, felim, gladhorn, iansilvester, mkyral, nate, subdiff
Priority: NOR    
Version: 5.13.2   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: output of kscreen-console bug
kcm_screen console output
kcm_screen console output
kcm_screen console output
kscreen config file
kscreen config file
kscreen config after start
corrected kscreen config
kscreen-console.bug
kscreen.log
kded5 restart log
Broken screen alignment
Screens in correct position
Broken kscreen output positions on log in
Correctly positions screen output
Clean wipe of kscreen dir with fresh files
Set multiscreen pref way I want them
Broken kscreen config again after a reboot
Centre screen rotated overlap occurs
Right screen rotate no overlap but screen vertical alignment moves from top to bottom

Description bugreporter11 2018-07-10 03:05:35 UTC
We have multiple computers running Arch Linux and using 3 displays. This worked reasonably well until the last couple weeks. Now the monitor settings are not remembered and must be reconfigured in KDE System Settings each time. Here is a specific example:

Lenovo ThinkPad laptop with Intel HD Graphics 620
plasmashell 5.13.2
Linux 4.17.3-1-ARCH #1 SMP PREEMPT Tue Jun 26 04:42:36 UTC 2018 x86_64 GNU/Linux
Lenovo dock with 3 1920x1080 monitors attached

* Expected behavior (which has been working for the last year):

Connect laptop to the dock and the 3 external monitors are activated automatically and the layout (size, position, etc.) was remembered. Docking "just worked" (although not if the computer was at sddm screen; user had to be logged into plasmashell when docking or undocking).

* New problematic behavior (started in last few weeks):

Connect laptop to the dock and the 3 external monitors are NOT activated automatically. Getting them to work requires going into System Settings and enabling each monitor, then positioning them in the correct layout.

Similar issues are observed on another laptop using 2 external monitors without a dock (via display ports on the laptop). Also, several desktop systems are now showing similar behavior. Upon reboot, the multimonitor settings are lost and must be reconfigured in KDE System Settings each time.

No related errors are shown in the logs. The monitors do work once configured. So the issue appears to be related to lost configuration / settings each time a laptop is docked / undocked (definite; confirmed on multiple laptops) (and, I think, possibly each time a desktop is restarted; observed several times but not yet replicated on other desktops).
Comment 1 Christoph Feck 2018-07-10 11:50:26 UTC
Please don't confirm your own bugs, unless you investigate exactly which package update or code change broke it.
Comment 2 Frederik Gladhorn 2018-07-13 19:39:57 UTC
Please add information according to this guide: https://community.kde.org/Solid/Projects/ScreenManagement#Debugging_Information
Comment 3 bugreporter11 2018-07-16 18:16:49 UTC
(In reply to Frederik Gladhorn from comment #2)
> Please add information according to this guide:
> https://community.kde.org/Solid/Projects/
> ScreenManagement#Debugging_Information

The instructions on that Wiki page are not clear to me. If an executable script is created in ~/.config/plasma-workspace/env/ with the statements export KSCREEN_LOGGING=1 and export QT_MESSAGE_PATTERN="[%{time hh::mm:s.zzz}] %{function}: %{message}" is it also necessary to manually execute those statements along with `kquitapp kded && kded5` as the Wiki suggests? I cannot ask my regular users to open a terminal and execute those commands and reproduce the error, but I can certainly enable debugging for them and ask the users to note the date & time when a problem happened. And I can later gather all the log files and attach them to a bug report. Will that be sufficient?
Comment 4 Ian Silvester 2019-04-09 02:01:43 UTC
I have reproduced this bug, using only the SystemSettings module, by disabling/enabling an external display.

Expected behaviour:
When dis/re-enabling a second display, it reappears in the exact same location relative to the main display.

Actual behaviour:
On re-enabling the display it it positioned at 0,0 and mirrors the laptop display.

Reproduction steps:
1. Have a laptop screen + 1 external screen positioned above and slightly to one side of the laptop screen.
2. Disable the external display using the settings module, apply and OK out of settings (crucial to close settings to reproduce the bug).
3. Re-open settings (the external screen will be shown further up and further right than when it was enabled).
4. Re-enable the external display. It will jump to be placed directly over the laptop screen. Apply - the external screen will mirror the laptop display.



Attachments:
- kscreen-console-debug - output of kscreen-console bug
- kcm_screen1 - console output of settings module when disabling external display, apply, ok
- kcm_screen2 - console output of settings module when settings re-opened
- kcm_screen3 - console output of settings module when re-enabling external display
- two config files from ~/.local/share/kscreen/
Comment 5 Ian Silvester 2019-04-09 02:03:05 UTC
Created attachment 119306 [details]
output of kscreen-console bug
Comment 6 Ian Silvester 2019-04-09 02:03:39 UTC
Created attachment 119307 [details]
kcm_screen console output
Comment 7 Ian Silvester 2019-04-09 02:03:51 UTC
Created attachment 119308 [details]
kcm_screen console output
Comment 8 Ian Silvester 2019-04-09 02:04:04 UTC
Created attachment 119309 [details]
kcm_screen console output
Comment 9 Ian Silvester 2019-04-09 02:04:24 UTC
Created attachment 119310 [details]
kscreen config file
Comment 10 Ian Silvester 2019-04-09 02:04:39 UTC
Created attachment 119311 [details]
kscreen config file
Comment 11 Marian Kyral 2019-10-22 14:55:02 UTC
Hi,
I'm affected by this as well. I have external display above my laptop screen. After update to Plasma 5.17 are, each time I start KDE, my displays cloned. I have to change config manually. But after kded5 restart, displays are cloned again. Hope attached logs will help.
Comment 12 Marian Kyral 2019-10-22 14:56:45 UTC
Created attachment 123410 [details]
kscreen config after start
Comment 13 Marian Kyral 2019-10-22 14:57:15 UTC
Created attachment 123411 [details]
corrected kscreen config
Comment 14 Marian Kyral 2019-10-22 14:57:51 UTC
Created attachment 123412 [details]
kscreen-console.bug
Comment 15 Marian Kyral 2019-10-22 14:59:38 UTC
Created attachment 123413 [details]
kscreen.log
Comment 16 Marian Kyral 2019-10-22 15:00:49 UTC
Created attachment 123414 [details]
kded5 restart log
Comment 17 Félim Whiteley 2019-10-23 08:24:30 UTC
This also effects me, KDE Neon 5.17.1 and still there. My layout is 3 1920x1080 monitors, the leftmost is vertical, the centre is the primary, they are all top aligned. On login it assumes they are bottom aligned but also overlaps the monitors, I've included a screenshot of the control panel, dragging them to their correct location fixes it straight away. It never saves it so on next login it's exactly the same issue again.

OS: KDE neon User Edition 5.17 x86_64 
Kernel: 5.0.0-32-generic 
Uptime: 16 mins 
Packages: 4177 
Shell: bash 4.4.20 
Resolution: 1080x1920, 1920x1080, 1920x1080 
DE: KDE 
WM: KWin 
WM Theme: Breeze 
Theme: Breeze [KDE], Breeze [GTK3] 
Icons: Breeze [KDE], Breeze [GTK3] 
Terminal: konsole 
Terminal Font: Hack 9 
CPU: AMD Ryzen 5 2600X (12) @ 3.600GHz 
GPU: AMD Radeon RX 470/480/570/570X/580/580X 
Memory: 3533MiB / 32142MiB
Comment 18 Félim Whiteley 2019-10-23 08:27:16 UTC
Created attachment 123434 [details]
Broken screen alignment
Comment 19 Félim Whiteley 2019-10-23 08:27:44 UTC
Created attachment 123435 [details]
Screens in correct position
Comment 20 Félim Whiteley 2019-10-29 09:05:55 UTC
Added comparison kscreen output now that I found it has a log. Also note happening on Suse too.

https://www.reddit.com/r/openSUSE/comments/docb7w/overlapping_displays_on_boot_tumbleweed/
Comment 21 Félim Whiteley 2019-10-29 09:06:37 UTC
Created attachment 123556 [details]
Broken kscreen output positions on log in
Comment 22 Félim Whiteley 2019-10-29 09:07:02 UTC
Created attachment 123557 [details]
Correctly positions screen output
Comment 23 Roman Gilg 2019-10-29 12:08:53 UTC
Please connect all screens. Then clean out your ~/.local/share/kscreen/ directory.

Do a restart and configure screen setup as you like. Make afterwards a copy of the directory (there should be only one file now besides the kscreen.log). Reboot again and assuming the positions are now broken make another copy of the directory.

Upload both copies here as attachments.
Comment 24 Félim Whiteley 2019-10-29 13:16:11 UTC
I've got a tarball of the dir 3 times, completely purged with a clean restart, set the way I want it and finally a restart with it broken again, it reliably fails each time...
Comment 25 Félim Whiteley 2019-10-29 13:16:41 UTC
Created attachment 123563 [details]
Clean wipe of kscreen dir with fresh files
Comment 26 Félim Whiteley 2019-10-29 13:17:10 UTC
Created attachment 123564 [details]
Set multiscreen pref way I want them
Comment 27 Félim Whiteley 2019-10-29 13:17:44 UTC
Created attachment 123565 [details]
Broken kscreen config again after a reboot
Comment 28 Roman Gilg 2019-10-29 16:15:49 UTC
Thanks for the dataset. So for some reason the coordinates get changed in some arbitrary way, everything else seems fine. However I tried to reproduce the issue with 3 monitors and there was no issue.

If you have a git checkout of KScreen can you comment out this line (the call to adjustPositions) and see if the problem persists:
https://cgit.kde.org/kscreen.git/tree/kded/output.cpp#n339
Comment 29 Félim Whiteley 2019-10-29 21:55:16 UTC
Created attachment 123576 [details]
Centre screen rotated overlap occurs
Comment 30 Félim Whiteley 2019-10-29 21:55:50 UTC
Created attachment 123577 [details]
Right screen rotate no overlap but screen vertical alignment moves from top to bottom
Comment 31 Marian Kyral 2019-10-31 16:14:31 UTC
> If you have a git checkout of KScreen can you comment out this line (the call to > adjustPositions) and see if the problem persists:
> https://cgit.kde.org/kscreen.git/tree/kded/output.cpp#n339

Hi,
I just tested and It seems that it helped. But was a quite tricky. I had to click to Apply button several times. First time, layout changed physically, but not in setting. It stay in clone mode. I changed it again and second Apply caused that screens switched - laptop was above the monitor. Third change and then it looked stable. Screen layout was correct and setting correspond with this.

Then I re-logged and layout was correctly restored. So definitely a good news for me ;-)
Comment 32 Christoph Feck 2019-11-11 10:04:19 UTC
New information was added with comment 29 and comment 30; changing status for inspection.
Comment 33 Félim Whiteley 2019-11-11 17:03:59 UTC
(In reply to Christoph Feck from comment #32)
> New information was added with comment 29 and comment 30; changing status
> for inspection.

I worked with Roman on this directly and assuming the change goes in tomorrow, based on what we discovered, it should fix all my issues.
Comment 34 Roman Gilg 2019-11-11 21:04:16 UTC
Git commit 0cf25b853ae3bff1bb1c1c05d6317994feedf061 by Roman Gilg.
Committed on 11/11/2019 at 21:04.
Pushed by romangilg into branch 'Plasma/5.17'.

fix(kded): read rotated output size

Summary:
When adjusting positions on config read respect the rotation value on reading
in the output size.
Related: bug 413627
FIXED-IN: 5.17.3

Test Plan: User tested it on a setup with one rotated output and two non-rotated outputs.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: davidedmundson, gmassullo, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25062

M  +18   -1    kded/output.cpp

https://commits.kde.org/kscreen/0cf25b853ae3bff1bb1c1c05d6317994feedf061
Comment 35 Roman Gilg 2019-11-11 21:44:23 UTC
I have not marked this bug as fixed by my commit since I don't know if OP's issue is because of vertical monitors. If OP can give feedback if 17.3 solved his issues, this bug can be closed as resolved.
Comment 36 Félim Whiteley 2019-11-20 09:33:54 UTC
Confirming my issue was fixed as last Neon update this morning. Cheers Roman!
Comment 37 Nate Graham 2019-11-20 15:47:30 UTC
Yay!