Bug 385135 - Monitor connection names differ across X11 and Wayland, causing multi-monitor containment mappings to break when switching session types
Summary: Monitor connection names differ across X11 and Wayland, causing multi-monitor...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: generic-multiscreen (show other bugs)
Version: 5.10.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: multiscreen, wayland
: 433840 446560 452231 458000 458847 460399 (view as bug list)
Depends on: 450068
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-27 11:23 UTC by humufr
Modified: 2022-12-15 18:46 UTC (History)
33 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.27


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description humufr 2017-09-27 11:23:26 UTC
I noticed that if I am using wayland or X11 the desktop configuration is not kept. 

I configured my X11 KDE (plasmashell) but I noticed that when logging on wayland I am back to the default layout (desktop).

Step to reproduce:

1. Log on multiscreen plasma. 
2. configure the attached screen (modifying the layout)
3. log out 
4. log on plasma wayland 

Result:

Second screen is back to default layout (desktop)

expected result:

Dual screen with the same configuration available in both login.
Comment 1 Christoph Feck 2017-10-12 20:49:32 UTC
Oh, I got the same, and was concluding that Wayland is not ready yet, because I just got a black screen (I only use the second display).

Will have to re-check if I am able to configure Wayland in a way to be useable, without destroying the X11 setup.
Comment 2 Alexandre Pereira 2018-03-23 11:52:22 UTC
this also happens to me, but there is a easy workaround:

I just logout,  go into .config/plasmashellrc and delete all the [ScreenConnectors] section.

At the new login, screens are correct again
Comment 3 humufr 2018-06-12 10:29:58 UTC
I am giving up on activities. I tried but it is so buggy that it is not possible to work with it. 

Random behaviour it is ok for a time after years...
Comment 4 Alexandre Pereira 2018-06-12 13:05:26 UTC
humufr,

even now on plasma git packages, its the same.

just follow the instruction: edit ~/.config/plasmashellrc and remove the [ScreenConnectors] section.

this happens because monitors have one name on Xorg and have another on Wayland. it has nothing to do with activities ( happens the same even if you have only one activity ).
Comment 5 David Edmundson 2018-06-15 23:30:53 UTC
This wont be fixed until we get both xdg output V2 and support in Qt.

Till then we can't do much as we don't get monitor names.
Comment 6 David Edmundson 2021-08-24 13:35:43 UTC
This is now resolved.

If issues remain we need to bug reports with new detailed information.
Comment 7 Alexandre Pereira 2021-08-28 11:54:16 UTC
It still changes the configuration if changing between wayland and x11.

For context, I have two monitors connected through DisplayPort.
It seems on Wayland they are called "DP-?" and on X11 they are called "DisplayPort-?".


output of the plasmashellrc file:

* Starting with a clean plasmashellrc file on wayland:
[ScreenConnectors]
0=DP-1
1=DP-2

* Starting with a clean plasmashellrc file on x11:
0=DisplayPort-0
1=DisplayPort-1


* Starting in X11 after being on wayland:
0=DisplayPort-0
1=DP-2
2=DisplayPort-1


This results on the monitor on the right showing another wallpaper/activity.


After cleaning the plasmashellrc files ( removing the ScreenConnectors section ) before changing wayland or x11, each session opens correctly with the proper activities on the correct monitors. But not if changing without cleaning/remocing the ScreenConnectors ID's.
Comment 8 Nate Graham 2021-08-28 12:03:17 UTC
Alexandre, are you using git master software? I don't believe the fix has been released yet.
Comment 9 Alexandre Pereira 2021-08-28 12:05:38 UTC
> Alexandre, are you using git master software? I don't believe the fix has been released yet.

Sorry Nate !!! I forgot to mention that! 

Yes, using master frameworks and plasma on gentoo, everything compiled 10 hours ago.
Comment 10 Nate Graham 2021-08-28 12:08:46 UTC
OK, thanks. I guess we still have a residual problem of the connector names changing across Wayland and X11. Using the connector name to identify screens is actually the root cause of a lot of our multi-monitor issues. I think we should switch to a more stable identifier like the monitor's serial number, and add a config UI to allow people to more easily move or clone containments/panels across screens.

At this point the wrong name issue *may* be a KScreen bug, but I'll leave it here and hopefully David Edmundson can chime in.
Comment 11 Alexandre Pereira 2021-08-28 12:18:18 UTC
> OK, thanks. I guess we still have a residual problem of the connector names changing across Wayland and X11. Using the connector name to identify screens is actually the root cause of a lot of our multi-monitor issues. I think we should switch to a more stable identifier like the monitor's serial number, and add a config UI to allow people to more easily move or clone containments/panels across screens.


Yes, thanks... that was why I didn't file the bug report immediately after seeing the post from Ed. I was the one that talked about it on kde matrix. ( mentioning the amdgpu bug )

But after seeing your weekly report, I thought it was a good time to update the bug.

Thanks for everything, Nate, Ed! 5.23/master git has been incredibly great !
Comment 12 Nate Graham 2021-10-06 19:11:30 UTC
*** Bug 433840 has been marked as a duplicate of this bug. ***
Comment 13 Anton K 2021-10-17 14:55:04 UTC
It seems still relevant

Operating System: KDE neon 5.23
KDE Plasma Version: 5.23.0
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.3
Comment 14 gudvinr+kde 2021-10-23 18:19:42 UTC
Probably can be fixed when/if this is implemented:
https://bugs.kde.org/show_bug.cgi?id=443986
Comment 15 Nate Graham 2021-11-08 21:28:18 UTC
*** Bug 445092 has been marked as a duplicate of this bug. ***
Comment 16 Nate Graham 2021-12-07 03:51:21 UTC
*** Bug 446560 has been marked as a duplicate of this bug. ***
Comment 17 pqwoerituytrueiwoq 2021-12-07 04:12:47 UTC
X11 uses this here
0=DisplayPort-2
1=DisplayPort-1
While wayland uses this
1=DP-2
2=DP-3

no matter what i do wayland still flips my screen around, it forces my primary/default to be on the left instead of the right
while logging in/out and switching to a TTY something broke (restarting sddm did not help) and plasma would not load and i only got 2 black screen, on X11 thunderbird still opened via a startup, luckily rebooting made it happy, kinda seems like stopping sddm does not stop/kill all user process in the session and leaves some running, i can confirm this with some of my scripts and they will not start back up cause there old instance is still running even after restarting sddm

on a side note audio devices says my primary monitor is on HDMI 3
however if you look at aplay -L this is this hardware
hw:CARD=HDMI,DEV=8
    HDA ATI HDMI, HDMI 2
    Direct hardware device without any conversions
i know this one is that cause it works with mpd
my primary has audio passthough to a jack mounted on my desk for headphones whole my main speakers on on the system's analog out on the motherboard
aplay -L finds 6 outputs on my RX 580 (there are 3 display ports, 1 hdmi, and one dvi)
DEV 3 = HDMI 0
DEV 7 = HDMI 1
DEV 8 = HDMI 2
DEV 9 = HDMI 3
DEV 10 = HDMI 4
DEV 11 = HDMI 5

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.88.0
Qt Version: 5.15.2
Kernel Version: 5.16.0-051600rc4-generic (64-bit)
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: Radeon RX 580 Series
Comment 18 Nate Graham 2022-01-11 23:32:32 UTC
*** Bug 447359 has been marked as a duplicate of this bug. ***
Comment 19 Nate Graham 2022-04-04 21:01:56 UTC
*** Bug 452231 has been marked as a duplicate of this bug. ***
Comment 20 Felix Miata 2022-05-24 07:16:41 UTC
Author of inxi seems to have implied using output names found in /sys/class/drm/ may have some value. Current inxi versions report the name(s) found there first, following with the names X or the display drivers converted them to.

# ls -1 /sys/class/drm/
card0
card0-DP-1
card0-DP-2
card0-HDMI-A-1
card0-HDMI-A-2
card0-HDMI-A-3
renderD128
version
# xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x46; cap: 0xf (Source Output, Sink Output, Source Offload, Sink Offload); crtcs: 3; outputs: 5; associated providers: 0; name: modesetting
    output HDMI-1
    output HDMI-2
    output DP-1
    output HDMI-3
    output DP-2
# inxi -IC
CPU:
  Info: dual core model: Intel Core i3-7100T bits: 64 type: MT MCP cache:
Info:...Shell: Bash inxi: 3.3.16
# inxi -GSaz
System:
  Kernel: 5.16.15-1-default...
  Desktop: KDE Plasma v: 5.24.4 tk: Qt v: 5.15.2 wm: kwin_x11 vt: 7 dm: TDM
    Distro: openSUSE Tumbleweed 20220427
Graphics:
  Device-1: Intel HD Graphics 630 vendor: Gigabyte driver: i915 v: kernel
    ports: active: DP-1,HDMI-A-1,HDMI-A-2 empty: DP-2,HDMI-A-3 bus-ID: 00:02.0
    chip-ID: 8086:5912 class-ID: 0300
  Display: x11 server: X.Org v: 21.1.3 compositor: kwin_x11 driver: X:
    loaded: modesetting unloaded: fbdev,vesa alternate: intel gpu: i915
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 2560x3720 s-dpi: 120 s-size: 540x785mm (21.26x30.91")
    s-diag: 953mm (37.51")
  Monitor-1: DP-1 pos: primary,bottom model: Acer K272HUL serial: <filter>
    built: 2018 res: 2560x1440 hz: 60 dpi: 109 gamma: 1.2
    size: 598x336mm (23.54x13.23") diag: 686mm (27") ratio: 16:9 modes:
    max: 2560x1440 min: 720x400
  Monitor-2: HDMI-A-1 mapped: HDMI-1 pos: middle model: Samsung built: 2009
    res: 1920x1080 hz: 60 dpi: 305 gamma: 1.2 size: 160x90mm (6.3x3.54")
    diag: 184mm (7.2") ratio: 16:9 modes: max: 1920x1080 min: 720x400
  Monitor-3: HDMI-A-2 mapped: HDMI-2 pos: primary,top model: NEC EA243WM
    serial: <filter> built: 2011 res: 1920x1200 hz: 60 dpi: 94 gamma: 1.2
    size: 519x324mm (20.43x12.76") diag: 612mm (24.1") ratio: 16:10 modes:
    max: 1920x1200 min: 640x480
  OpenGL: renderer: Mesa Intel HD Graphics 630 (KBL GT2) v: 4.6 Mesa 22.0.2
    direct render: Yes
#
Monitor-3 is in fact connected via DVI-DVI cable connected to motherboard's DVI connector.

Suggested possible user workaround: use modesetting DIX display driver instead of device specific (DDX) display driver. Output names tend to be more consistent among AMD, Intel & NVidia when using the DIX.
Comment 21 Nate Graham 2022-06-15 13:43:24 UTC
*** Bug 449321 has been marked as a duplicate of this bug. ***
Comment 22 Nate Graham 2022-08-17 20:12:36 UTC
*** Bug 458000 has been marked as a duplicate of this bug. ***
Comment 23 Felix Miata 2022-10-13 23:35:04 UTC
*** Bug 460399 has been marked as a duplicate of this bug. ***
Comment 24 cellstije 2022-10-14 09:02:48 UTC
Hi,

note that the switching of layout (primary to secondary) happens in wayland also when:

* only one monitor is on (of the 2 attached)
* monitor goes in (screen) power saving and turns off
* system is woken from screen power saving by end user.

The end-user is presented with secondary monitor wallpaper, primary monitor plasma widgets are gone and there is no way to get them back:
Ticking and un-ticking 'primary' option in System Settings->Display amd Monitor achieve nothings

This bug is actually a duplicate of bug:

https://bugs.kde.org/show_bug.cgi?id=458847

that was closed as  supposingly  fixed in 5.26.0
Comment 25 Nate Graham 2022-10-14 18:03:47 UTC
*** Bug 458847 has been marked as a duplicate of this bug. ***
Comment 26 Nate Graham 2022-10-14 18:04:35 UTC
This will very likely be fixed automatically once Bug 450068 is done, but is probably impossible to fix otherwise.
Comment 27 Bug Janitor Service 2022-11-22 22:42:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/3230
Comment 28 Vlad Zahorodnii 2022-11-23 14:16:53 UTC
Git commit f881bdf51b55b0ace76e9919b812ba87c8a8f040 by Vlad Zahorodnii.
Committed on 23/11/2022 at 13:31.
Pushed by vladz into branch 'master'.

backends/drm: Use drmModeGetConnectorTypeName()

It ensures that connector type naming is consistent across compositors
and saves us some work adding string mappings.

drmModeGetConnectorTypeName() uses the same naming scheme as the drm
backend so the client side should be unaffected by this change.

M  +1    -1    CMakeLists.txt
M  +5    -31   src/backends/drm/drm_connector.cpp

https://invent.kde.org/plasma/kwin/commit/f881bdf51b55b0ace76e9919b812ba87c8a8f040
Comment 29 Marco Martin 2022-12-15 10:16:37 UTC
Git commit 8c521e528adc69a920c161cc691f1322dc2089f8 by Marco Martin.
Committed on 15/12/2022 at 10:16.
Pushed by mart into branch 'master'.

Base containments upon screen order

Base containment/view screen assignment uniquely on an ordered list of screens which will be decided by KScreen, removing the concept of primary screen and the whole load and save of screen connector/id association.
A protocol based on Atoms on X11 and as a native protocol on Wayland tells plasma the complete order of the screens, allowing the user to set not only primary screen but the whole order from the KSCreen KCM.

Note that this is still very early work, as the protocol doesn't exists yet and is purely based upon primary screen followed by the other screens based upon alphabetical order of connector names. As many multiscreen scenarios as possible will be tested within screenpooltest and shelltest
Related: bug 450068, bug 427861

Testing done:
- [x] X11 absolutely no config whatsoever - plasma should match kscreen kcm when finally open
- [x] Wayland absolutely no config whatsoever - plasma should match kscreen kcm when finally open 
- [x] X11 had a single monitor config - things should look exactly as before
- [x] Wayland had a single monitor config - things should look exactly as before
- [x] X11 had a multi-monitor config, one screen was Primary - things should look exactly as before
- [x] Wayland had a multi-monitor config, one screen was Primary - things should look exactly as before
- [x] X11 Xaver's mental setup with matching EDID
- [x] Wayland Xaver's mental setup with matching EDID
- [x] X11 have laptop lid and close it then open with two screens
- [x] Wayland have laptop lid and close it then open with two screens
- [x] X11 no kscreen enabled. Something remains sane, and somewhat consistent
- [x] wayland no kscreen enabled. Something remains setup, and somewhat consistent
- [x] close/reopen laptop lid with external screen attached
- [x] enable/disable outputs without reordering
- [x] connecting disconnecting to go from 1 to 2 to 3, to 2 again etc
- [x] watch behavior of panels, do they move to the expected screen?

M  +5    -4    shell/CMakeLists.txt
M  +2    -1    shell/autotests/CMakeLists.txt
M  +9    -7    shell/autotests/mockserver/CMakeLists.txt
M  +2    -2    shell/autotests/mockserver/mockcompositor.cpp
M  +6    -6    shell/autotests/mockserver/mockcompositor.h
R  +15   -10   shell/autotests/mockserver/outputorder.cpp [from: shell/autotests/mockserver/primaryoutput.cpp - 069% similarity]
R  +10   -12   shell/autotests/mockserver/outputorder.h [from: shell/autotests/mockserver/primaryoutput.h - 068% similarity]
M  +135  -136  shell/autotests/screenpooltest.cpp
M  +393  -43   shell/autotests/shelltest.cpp
A  +354  -0    shell/outputorderwatcher.cpp     [License: LGPL(v2.0+)]
A  +115  -0    shell/outputorderwatcher.h     [License: LGPL(v2.0+)]
M  +1    -1    shell/panelview.cpp
D  +0    -167  shell/primaryoutputwatcher.cpp
D  +0    -58   shell/primaryoutputwatcher.h
M  +110  -315  shell/screenpool.cpp
M  +17   -32   shell/screenpool.h
M  +2    -1    shell/scripting/scriptengine_v1.cpp
M  +12   -12   shell/shellcontainmentconfig.cpp
M  +210  -185  shell/shellcorona.cpp
M  +5    -3    shell/shellcorona.h
M  +3    -3    shell/strutmanager.cpp
M  +6    -4    shell/tests/CMakeLists.txt
M  +7    -15   shell/tests/screenpooltest.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/8c521e528adc69a920c161cc691f1322dc2089f8