Bug 429266

Summary: Unplugging and replugging screen leads to configuration issues
Product: [Plasma] KScreen Reporter: Riccardo Robecchi <sephiroth_pk>
Component: commonAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: ongun.kanat
Priority: NOR    
Version: 5.20.3   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The outputs before unplugging the dock
The outputs after replugging the dock

Description Riccardo Robecchi 2020-11-17 21:34:31 UTC
SUMMARY
I have a laptop connected to a USB-C docking station, which is then connected to an external monitor using a DisplayPort cable. If I plug in the docking station at login time, the screen is enumerated as "DisplayPort-4", but if I unplug and then re-plug the dock the screen becomes "DisplayPort-5" and loses all the associated configuration (e.g. panels, docks, wallpaper, etc). To be more correct, it does not use the configuration, as it is seen as a different screen; the configuration is not actually lost. Moreover, when I re-plug the USB-C cable I have to manually activate the screen, otherwise it is disabled.
If I plug in the dock after the login, then everything works as expected and unplugging and re-plugging the dock has no effect whatsoever on the screen as it should be.

STEPS TO REPRODUCE
1. plug in a display at login
2. unplug it after the login
3. re-plug it

OBSERVED RESULT
The screen is disabled and needs manual enabling in the settings; moreover, it "loses" the configuration with elements such as panels, docks and wallpapers not being shown.

EXPECTED RESULT
Re-plugging the screen leads to it working as it did before unplugging it.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon Focal 
KDE Plasma Version: 5.20.3
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1

ADDITIONAL INFORMATION
Comment 1 Riccardo Robecchi 2021-02-24 22:54:32 UTC
I found out in the intervening time that this issue can be avoided completely by getting to the login screen without the external monitor plugged in. Plugging it in after the login leads to everything working as expected.
Comment 2 Ongun Kanat 2021-03-12 00:32:03 UTC
I don't think this is a Plasma/KScreen bug. Probably a kernel or userspace driver bug. Because one can check xrandr and replugging will result in increment in the port number.
Comment 3 Riccardo Robecchi 2021-03-15 16:17:22 UTC
(In reply to Ongun Kanat from comment #2)
> I don't think this is a Plasma/KScreen bug. Probably a kernel or userspace
> driver bug. Because one can check xrandr and replugging will result in
> increment in the port number.

It may indeed be an issue with the kernel or with the userspace driver, but the issue was not present before Plasma 5.19 and this is what has led me to file the bug here.
Comment 4 Ongun Kanat 2021-07-09 02:25:15 UTC
Created attachment 139962 [details]
The outputs before unplugging the dock

Sorry for the delayed response. Due to many hardware issues with my T14, I stopped using Linux as my main desktop OS. I booted my system and noticed the bug again and remembered this bug report so I decided to test it properly.

Hardware info: Thinkpad T14 AMD Gen 1 and Thinkpad USB-C dock Gen 2


This is definitely not a KDE / KWin / KScreen bug. To be sure, I decided to use a completely different software stack to test it. I used a wlroots based Wayland compositor, Wayfire [1]. With wlr based compositors, one can use wlr-randr utility in a similar way to xrandr. As it can be seen in the attachments the port organization changes after unplugging and replugging the dock.
Comment 5 Ongun Kanat 2021-07-09 02:25:53 UTC
Created attachment 139963 [details]
The outputs after replugging the dock
Comment 6 Riccardo Robecchi 2021-07-17 19:38:22 UTC
(In reply to Ongun Kanat from comment #4)
> Created attachment 139962 [details]
> The outputs before unplugging the dock
> 
> Sorry for the delayed response. Due to many hardware issues with my T14, I
> stopped using Linux as my main desktop OS. I booted my system and noticed
> the bug again and remembered this bug report so I decided to test it
> properly.
> 
> Hardware info: Thinkpad T14 AMD Gen 1 and Thinkpad USB-C dock Gen 2
> 
> 
> This is definitely not a KDE / KWin / KScreen bug. To be sure, I decided to
> use a completely different software stack to test it. I used a wlroots based
> Wayland compositor, Wayfire [1]. With wlr based compositors, one can use
> wlr-randr utility in a similar way to xrandr. As it can be seen in the
> attachments the port organization changes after unplugging and replugging
> the dock.

Thank you for your effort! I'm marking this as an upstream bug then.