Bug 466208

Summary: OSD and applet: "Switch to external display" mode not remembered after reboot
Product: [Plasma] KScreen Reporter: Sebastian Turzański <dpbasti>
Component: OSD and Plasma appletAssignee: kscreen-bugs-null <kscreen-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: Bmoon2023, jeremyrand, miranda, nate, plasma-bugs, sph
Priority: NOR Keywords: multiscreen
Version: 5.27.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 6.0
Sentry Crash Report:
Attachments: displaywidget
widget-before_reboot
widget-after-reboot
controlcenter-before-reboot
controlcenter-after-reboot

Description Sebastian Turzański 2023-02-21 20:20:39 UTC
My external monitor connected via Displaylink  USB-C dock is selected as the primary and only monitor while my laptop's build-in display is disabled. 
I have to set it up this way after each reboot as the settings are lost after reboot.


STEPS TO REPRODUCEI confirm the same behavior - to me it started with Plasma 5.27 on Opensuse Tumbleweed

1. Boot to KDE with a laptop connected to a USB-C docking station with external monitor
2. See both internal (laptop) display and external display working
3. Change preference via kcontrolcenter to switch off internal laptop display (switch to external display only)
4. Reboot


OBSERVED RESULT
Again both displays are on

EXPECTED RESULT
Settings should be persistant

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Opensuse tumbleweed
(available in About System)
KDE Plasma Version: 5.27
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Wayland session
Comment 1 Nate Graham 2023-02-22 18:51:09 UTC
Just gave this a try with a nearly-identical setup:
- Laptop
- USB-C dock with HDMI screen plugged into it
- Laptop internal screen disabled in KScreen KCM
-Reboot

After logging in, the laptop screen is correctly turned off and the external screen is the only one that's turned on.

To debug this further, can you please provide the following information?
1. What GPU does the laptop use?
2. Before reboot, can you verify that the internal screen is marked as disabled in System Settings' Display and Monitor page? Or is it enabled?
3. After reboot, can you verify that the internal screen is marked as enabled in System Settings' Display and Monitor page? Or is it disabled?
3. Can you attach the output of `kscreen-doctor -o` in a terminal window before reboot, and after reboot?
Comment 2 Sebastian Turzański 2023-02-23 07:22:23 UTC
I know what the issue was.
I was not using the settings center. Instead I always used this new widget in the tray that allows to selected display layout (switch to external display)

When I do everything in the configuration center all works as expected.

Is that the idea that the widget is not persistent?
Comment 3 Nate Graham 2023-02-23 13:53:40 UTC
The widget is provided by NVIDIA and does not manipulate the screen arrangement in a way that's compatible with the rest of the system. I strongly recommend never using it to change the screen arrangement.
Comment 4 Sebastian Turzański 2023-02-23 20:38:50 UTC
Created attachment 156660 [details]
displaywidget

I don't think it is an NVIDIA, looks like pure Plasma tray widget.
See screenshot attached
Comment 5 Nate Graham 2023-02-23 23:21:54 UTC
Aha, indeed that's not NVIDIA.
Comment 6 Nate Graham 2023-02-23 23:22:36 UTC
(In reply to Nate Graham from comment #1)
> To debug this further, can you please provide the following information?
> 1. What GPU does the laptop use?
> 2. Before reboot, can you verify that the internal screen is marked as
> disabled in System Settings' Display and Monitor page? Or is it enabled?
> 3. After reboot, can you verify that the internal screen is marked as
> enabled in System Settings' Display and Monitor page? Or is it disabled?
> 3. Can you attach the output of `kscreen-doctor -o` in a terminal window
> before reboot, and after reboot?
Can you please answer these questions?
Comment 7 Sebastian Turzański 2023-02-24 11:07:34 UTC
Created attachment 156668 [details]
widget-before_reboot
Comment 8 Sebastian Turzański 2023-02-24 11:07:58 UTC
Created attachment 156669 [details]
widget-after-reboot
Comment 9 Sebastian Turzański 2023-02-24 11:08:21 UTC
Created attachment 156670 [details]
controlcenter-before-reboot
Comment 10 Sebastian Turzański 2023-02-24 11:08:50 UTC
Created attachment 156671 [details]
controlcenter-after-reboot
Comment 11 Sebastian Turzański 2023-02-24 11:09:24 UTC
(In reply to Nate Graham from comment #6)
> (In reply to Nate Graham from comment #1)
> > To debug this further, can you please provide the following information?
> > 1. What GPU does the laptop use?
> > 2. Before reboot, can you verify that the internal screen is marked as
> > disabled in System Settings' Display and Monitor page? Or is it enabled?
> > 3. After reboot, can you verify that the internal screen is marked as
> > enabled in System Settings' Display and Monitor page? Or is it disabled?
> > 3. Can you attach the output of `kscreen-doctor -o` in a terminal window
> > before reboot, and after reboot?
> Can you please answer these questions?

1. Dual gpu with Nvidia+build-in, prime-select not configured for any driver but nvidia loaded anyway
2. If I switch with screen of using the widget it is also marked as off in control center
3. It is marked as enabled
4. Attaching files
Comment 12 Nate Graham 2023-02-24 17:34:00 UTC
Aha, thanks. This is Bug 460341, then.

*** This bug has been marked as a duplicate of bug 460341 ***
Comment 13 Nate Graham 2023-03-06 16:23:32 UTC
Apparently not fixed with the fix for Bug 460341; re-opening.
Comment 14 Stephane Travostino 2023-03-07 10:05:32 UTC
I have this exact same issue that presents after sleep/resume, where my second monitor, which I usually keep turned off, is re-activated. Of course the same happens after rebooting as well.

It's not limited to proprietary drivers, I'm using an AMD card.
Comment 15 Nate Graham 2023-03-07 18:04:21 UTC
Stephane, let's use this bug report for Sebastian's specific issue. Can you submit a new one for your issue? Thanks!
Comment 16 Nate Graham 2023-03-15 17:17:53 UTC
*** Bug 467365 has been marked as a duplicate of this bug. ***
Comment 17 Stephane Travostino 2023-07-02 09:59:48 UTC
(In reply to Nate Graham from comment #15)
> Stephane, let's use this bug report for Sebastian's specific issue. Can you
> submit a new one for your issue? Thanks!

I'm not sure mine is worthy of another bug report just to be closed as DUPLICATE, as my issue is the same.

If I clear `.local/share/kscreen`, everything works as intended, KScreen creates one config, and everything works fine. When I resume from sleep or reboot, the screens keep the last configuration.

But after a while, not sure what's the trigger, I see 3 different configs stored under `.local/share/kscreen` and none of my configurations are retained. It seems that the logic to determine what is a new Display Arrangement or a pre-existing one in KScreen to be completely borked, and it might be because I'm making use of the Extend Screen feature like OP did.
Comment 18 Nate Graham 2023-07-25 21:22:00 UTC
Can reproduce the issue when using the Extend button in the widget. The KCM works fine. The code paths must be subtly different here.
Comment 19 Stephane Travostino 2023-07-26 07:05:55 UTC
I have started using a custom script to toggle my second monitor with kscreen-doctor and this issue does not appear. It presents only after using the Extend widget. 

So for me the only workaround was to delete all kscreen configuration files to start again fresh, and just use kscreen-doctor, avoiding the widget at all. 

On Tue, 25 Jul 2023, at 22:22, Nate Graham wrote:
> https://bugs.kde.org/show_bug.cgi?id=466208
>
> Nate Graham <nate@kde.org> changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>            Keywords|                            |multiscreen
>              Status|REPORTED                    |CONFIRMED
>             Summary|Display arrangement is lost |Preference to disable
>                    |after reboot when using     |laptop screen while
>                    |"Extend" button in KScreen  |external screen is
>                    |widget                      |connected is lost after
>                    |                            |reboot when using "Extend"
>                    |                            |button in KScreen widget
>      Ever confirmed|0                           |1
>
> --- Comment #18 from Nate Graham <nate@kde.org> ---
> Can reproduce the issue when using the Extend button in the widget. The KCM
> works fine. The code paths must be subtly different here.
>
> -- 
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 20 Nate Graham 2023-07-26 20:17:06 UTC
Can still reproduce in Plasma 6.
Comment 21 Zamundaaa 2023-10-05 19:42:06 UTC
Git commit ae84480fbfdc684b8ee4b0207d3ce679f6fb4cd7 by Xaver Hugl.
Committed on 05/10/2023 at 20:29.
Pushed by zamundaaa into branch 'master'.

outputconfigurationstore: add new config system

Instead of an external service (like KScreen) storing and restoring output configurations,
with this commit KWin takes over that responsibility. This allows it to, among other things,
generate appropriate configs for new sets of outputs immediately, and take KWin-internal information
about outputs into account when generating them.
Related: bug 455082, bug 457430, bug 474021, bug 469653, bug 466342, bug 470863, bug 466556

M  +1    -0    CMakeLists.txt
M  +1    -0    autotests/integration/kwin_wayland_test.cpp
M  +1    -0    src/CMakeLists.txt
M  +5    -0    src/backends/drm/drm_output.cpp
M  +9    -0    src/core/output.cpp
M  +11   -0    src/core/output.h
M  +1    -0    src/core/outputconfiguration.h
M  +7    -0    src/main.cpp
M  +1    -0    src/main.h
M  +0    -4    src/main_wayland.cpp
M  +709  -20   src/outputconfigurationstore.cpp
M  +68   -4    src/outputconfigurationstore.h
M  +1    -0    src/utils/CMakeLists.txt
M  +8    -0    src/utils/edid.cpp
M  +8    -0    src/utils/edid.h
A  +54   -0    src/utils/orientationsensor.cpp     [License: GPL(v2.0+)]
A  +38   -0    src/utils/orientationsensor.h     [License: GPL(v2.0+)]
M  +34   -1    src/wayland/outputdevice_v2.cpp
M  +1    -0    src/wayland/outputdevice_v2.h
M  +12   -1    src/wayland/outputmanagement_v2.cpp
M  +49   -6    src/workspace.cpp
M  +2    -0    src/workspace.h

https://invent.kde.org/plasma/kwin/-/commit/ae84480fbfdc684b8ee4b0207d3ce679f6fb4cd7
Comment 22 Zamundaaa 2024-02-12 18:07:44 UTC
*** Bug 472732 has been marked as a duplicate of this bug. ***