Plasma 6 and Wayland multi-monitor order?

I’ve been using KDE since at least Fedora 34 KDE, and KDE’s Wayland session since Fedora KDE made it default. Since at least 2022 when I noticed some quirks with mpv functions and my then new multi-monitor setup, my two displays always followed the same order in wayland-info.
I can boot my Fedora 39 KDE install with 5.27.10 and relog/reboot as long as I want and the order of my displays in the wl_output section will remain the same. DP1 followed by DP2.

I moved to CachyOS while it was on 5.27.10, and after upgrading it to Plasma 6.0.1 I immediately noticed that the order of my displays in wl_output was changing on different sessions (through mpv again, when the behavior of some functions suddenly flipped). Sometimes it’s DP1>DP2, other times DP2>DP1. It can take a few relogs/reboots, but it eventually happens.
xdg_output changes order with it, but as far as the mpv interaction goes wl_output is the one that matters.
Additionally, running xrandr (for xwayland in this case?) shows DP1 and DP2 following whatever wl_output order they’re in. On an actual X11 session it seems to always be DP1 followed by DP2.

This doesn’t seem to have any other obvious negative effects, but I’m still curious whether this was an intentional change or a bug. I tried to make a report but was misunderstood and maybe on the wrong product to begin with, but I’m not sure.

I also made a Fedora Workstation (Gnome 45.4) install and that seems to keep a fixed wl_output order like Plasma 5.27.10. But unlike on there, xdg_output and wl_output are both always DP1>DP2. On Plasma 5.27.10 xdg_output is always DP2>DP1 and wl_output is DP1>DP2.

The interaction with mpv is this. When mpv is starting up with a Wayland context, it scans your outputs and seems to base initial settings by the resolution/refresh of the last one it saw. The order scanned follows what wayland-info reports in wl_output. Since my monitors are 1440p (DP1) and 1080p (DP2), that leads to different resize-larger results when it flips.
It does a similar scan for X11 contexts, but when mpv is forced to run with an X11 context on Wayland it still figures out which display is the actual primary when the xrandr order is reversed.
I know it’s mpv’s own problems, but it’s a symptom of what I’m experiencing between Plasma 5 and 6.

I’ve tried EndeavourOS and KDE Neon and Plasma 6 on those had the changing wl_output order too.
I also tried with my older PC (using HDMI primary and mini-DP secondary) and still experienced the same things between Plasma 5 and Plasma 6.
Both systems use an AMD GPU. My current is an RX 6700 XT, the older one is an R9 280 using amdgpu.si_support=1.

Just found this has an interaction with gamescope. When wl_output is DP2>DP1, gamescope -f will launch on DP2 (the secondary, side monitor). Though if I use SDL_VIDEODRIVER=x11, it will then launch on DP1.
When the wl_output order is DP1>DP2, it launches on DP1 either way as expected.

This is a legitimate issue, I think. Has nobody else experienced anything as a result of this, or verified the behavior between Plasma 5.27 and Plasma 6?

TBH your text is way too long and I think it’s likely that no one read it.

Can you give us the TL;DR version of the problem?

On Plasma 5.27.X, wayland-info always reports wl_output in the order of DP-1 followed by DP-2. Observed on two PCs with different AMD GPU models.

On Plasma 6.0.X, wayland-info sometimes reports wl_output as either DP-1 followed by DP-2, or DP-2 followed by DP-1. It seems to change by session. Log out back to SDDM and in again or full reboots can do it. Observed with the same two PCs.

On Gnome 45.4, wayland-info seemed to stick with wl_output as DP-1 followed by DP-2 when I tried relogging/rebooting for half an hour. Did this to see how a different DE behaved.

Generally the order of wl_output doesn’t seem to matter. But when it’s DP-2 followed by DP-1, some applications end up behaving unexpectedly.
As I’ve written previously I noticed it with some mpv functions, and gamescope opening on the second screen with the fullscreen option.

I don’t know if wl_output is actually the culprit but it is what’s immediately apparent. And the effects are consistent when it flips.

To be sure I made another fresh install of KDE Neon (user edition) which still had wl_output flip on the first reboot after updating the kernel. With mpv reacting accordingly.

I’m having this same issue on Fedora 40 with 4 displays. My configuration hasn’t changed from Fedora 39 to 40, but fullscreen applications (in my case, gamescope) are opening on my second display instead of my primary display.

Under Display in KDE settings, I have the priority order set to DP-1 > DP-2 > HDMI-A-1 > HDMI-A-2. The output of kscreen-doctor -o also reflects this order with DP-1 as priority 1 through HDMI-A-2 as priority 4.

The output of wayland-info, however, has wl_output dropping DP-1 to the last screen in the order with the others remaining in otherwise the same order, e.g. DP-2 > HDMI-A-1 > HDMI-A-2 > DP-1.

I agree with @DonKatsu that this is at least showing us the cause for this symptom, but it unfortunately doesn’t point us at a root cause yet.

1 Like

Still occurring with Plasma 6.1.2.
Gamescope seemed to (unintentionally?) work around it shortly after I posted that reply, at least?

I can confirm the issue in plasma 6.1.5, wayland monitor order is randomly changing, even when sleeping. Three monitors, using kwin shortcuts to move window to screen-0 to screen-2, shortcuts stay the same, window order changes, very annoying.

Could this be a problem with the handling of hot-plug events? In particular Display-Port connected monitors seem to give away more info about their connection/power state.

One experiment that might be worth a try is disable KScreen2 which seems to take action on hot-plugging of monitors. This can be easily done via the Background Services application which used to be part of Settings, but is now separate, and can be found by using the launcher to search for Background Services.