Bug 416475 - Display Configuration not saved properly on Wayland with multiple monitors
Summary: Display Configuration not saved properly on Wayland with multiple monitors
Status: RESOLVED FIXED
Alias: None
Product: KScreen
Classification: Plasma
Component: common (show other bugs)
Version: 5.24.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords: multiscreen, wayland
Depends on:
Blocks:
 
Reported: 2020-01-19 19:39 UTC by symbiogenesis
Modified: 2022-11-10 18:02 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Before (94.82 KB, image/png)
2020-01-27 04:36 UTC, symbiogenesis
Details
After (94.11 KB, image/png)
2020-01-27 04:37 UTC, symbiogenesis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description symbiogenesis 2020-01-19 19:39:14 UTC
SUMMARY

I have two monitors, one using HDMI and one using DisplayPort. While using wayland, I try changing the display configuration so that one is on the left, and the other is on the right.

Saving this works for a little bit, but eventually upon reboot it will revert to the previous setting. Possibly because the settings are being saved to /tmp/ and getting cleaned out?

STEPS TO REPRODUCE
1. Use multi-monitor on wayland
2. Change position of the monitors in the display configuration, and save.
3. Reboot a few times.

OBSERVED RESULT

The saved configuration is reverted

EXPECTED RESULT

The saved configuration is remembered

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: kernel version 5.4.13
(available in About System)
KDE Plasma Version: 5.17.90 (5.18 Beta)
KDE Frameworks Version: 5.66
Qt Version: 5.14

ADDITIONAL INFORMATION
Comment 1 Roman Gilg 2020-01-21 13:30:09 UTC
With X11 you don't have this issue?

Settings are saved normally in $HOME/.local/share/kscreen

Check there how the files look before and after reboot. Also please create two screenshots of the KCM before and after reboot. Thanks!
Comment 2 symbiogenesis 2020-01-23 23:48:33 UTC
My kscreen config. Note the position attributes

Before it reverts:

[
    {
        "enabled": true,
        "id": "ACR DP-1-GN246HL/LW3AA0018532",
        "metadata": {
            "name": "ACR DP-1-GN246HL/LW3AA0018532"
        },
        "mode": {
            "refresh": 60,
            "size": {
                "height": 1080,
                "width": 1920
            }
        },
        "pos": {
            "x": 1920,
            "y": 0
        },
        "primary": false,
        "rotation": 1,
        "scale": 1
    },
    { 
        "enabled": true,
        "id": "ACR HDMI-A-1-GN246HL/LW3AA0018532",
        "metadata": {
            "name": "ACR HDMI-A-1-GN246HL/LW3AA0018532"
        },
        "mode": {
            "refresh": 60,
            "size": {
                "height": 1080,
                "width": 1920
            }
        },
        "pos": {
            "x": 0,
            "y": 0
        },
        "primary": true,
        "rotation": 1,
        "scale": 1
    }
]



After it reverts:

[
    {
        "enabled": true,
        "id": "ACR DP-1-GN246HL/LW3AA0018532",
        "metadata": {
            "name": "ACR DP-1-GN246HL/LW3AA0018532"
        },
        "mode": {
            "refresh": 60,
            "size": {
                "height": 1080,
                "width": 1920
            }
        },
        "pos": {
            "x": 0,
            "y": 0
        },
        "primary": false,
        "rotation": 1,
        "scale": 1
    },
    { 
        "enabled": true,
        "id": "ACR HDMI-A-1-GN246HL/LW3AA0018532",
        "metadata": {
            "name": "ACR HDMI-A-1-GN246HL/LW3AA0018532"
        },
        "mode": {
            "refresh": 60,
            "size": {
                "height": 1080,
                "width": 1920
            }
        },
        "pos": {
            "x": 1920,
            "y": 0
        },
        "primary": true,
        "rotation": 1,
        "scale": 1
    }
]
Comment 3 symbiogenesis 2020-01-26 19:25:46 UTC
I do not have this problem with X11.
Comment 4 symbiogenesis 2020-01-27 04:36:50 UTC
Created attachment 125455 [details]
Before

Before
Comment 5 symbiogenesis 2020-01-27 04:37:07 UTC
Created attachment 125456 [details]
After

After
Comment 6 symbiogenesis 2020-01-27 04:38:59 UTC
Actually seems to be related to sleeping, which of course puts the monitors into power save mode eventually, and hotplugging.

Rebooting in a way that never turns off the monitors doesn't produce the problem.
Comment 7 S.Trzmiel 2021-09-13 10:37:37 UTC
I've got similar behavior on laptop with external display using Wayland 1.19/Qt 5.15.2/KF 5.85/Plasma 5.22.5 (Fedora 34 rpms) wayland session.
Quite often after resume from suspend my desktop settings are messed up.
"Primary" desktop (one with default panel) is ok, but "secondary" desktop  settings are reset to defaults, also which desktop is placed on which display is quite random.
At least with plasma 5.22 desktop settings are applied properly after reboot.
This issue currently is not present under X11 session.
Comment 8 Vladimir Yerilov 2021-11-23 15:08:32 UTC
Confirm the above, happens without sleep/resume, disconnecting and re-connecting external monitor when Plasma is running is enough to reproduce on my side. It always ends up with a laptop screen to the left and external screen to the right.
There's also another aspect of this issue however. Every time I disconnect my external monitor (set as the primary one), laptop's display becomes the primary screen, which is fine, BUT: when connecting that external monitor back, I expect it to become primary again, though it never happens. This is 100% reproducible on login: my laptop's screen is always set to be the primary one even if I ended the previous session (no matter Wayland or X11) with it being the secondary. This affects of course all Plasma widgets, Latte dock and wallpapers.
In other words, every time ends up with launching of System Settings and setting primary display again after each login or monitor re-connection.

My external monitor is connected via HDMI cable using laptop's HDMI port or USB-C hub with HDMI port -- it doesn't matter, every time the result is the same. It never happens in X11 session though.
Comment 9 Ian Sutter 2022-06-20 23:26:05 UTC
My problem may be related to this bug as well. I have two essentially identical 1080p monitors and it seems that (especially when using Wayland), the monitors settings don't apply properly for me. If I logout, then login again, my monitors are mirrored instead of extended even though I set it to extend in the previous session. Another thing of note is that when I click "apply" to save my monitor changes, it doesn't actually seem to notice that it saved the changes. When I go to close the system settings program, it asks me if I want to save or discard my monitor settings even though I already saved them and didn't make any changes after saving them.
Comment 10 Amado 2022-10-08 11:54:25 UTC
I recently installed Nobara Linux, and the version I chose comes with Wayland.

When I was initially installing the OS, the live USB installation configured my triple monitors just fine, but once I installed it onto my hard drive, as soon as the first boot I was running across the issues noted above.

I have 3 monitors, 2 of them are identical (and I suspect this may have something to do with it, I'm not sure) and the other is from HP.
I have the two identical monitors (ONN monitors) on the sides of the HP monitor. 

When I log on, the two ONN monitors mirror each other and I have to go into Display settings to change it.
But when the settings open up, I only see 2 monitors, and it's not until I click on the ONN monitor to the right of my HP monitor that the other monitor pops up BEHIND it (its the weirdest thing).
Once that third monitor finally shows up, then I'm able to move them to the right place, and when I hit apply the changes happen (my monitors are on the right place) but the (*) at the top of the window showing that there are unsaved changes doesn't go away because I assume it hasn't properly applied these new settings to a config file. And again, when I click to close the settings window, it asks me if I'm sure I want to leave without saving (again, clicking save doesn't have any effect).

These are my settings in $HOME/.local/share/kscreen/140737127c1f84dab4342c93476a5523 (the only config file there)

[
    {
        "enabled": true,
        "id": "4b4ebb4206f61e68a1cefc3b07556a7f",
        "metadata": {
            "fullname": "xrandr-100002487-16843009",
            "name": "ONN 100002487/16843009"
        },
        "mode": {
            "refresh": 60,
            "size": {
                "height": 1080,
                "width": 1920
            }
        },
        "overscan": 0,
        "pos": {
            "x": 3840,
            "y": 0
        },
        "primary": false,
        "rgbrange": 0,
        "rotation": 1,
        "scale": 1,
        "vrrpolicy": 0
    },
    {
        "enabled": true,
        "id": "4b4ebb4206f61e68a1cefc3b07556a7f",
        "metadata": {
            "fullname": "xrandr-100002487-16843009",
            "name": "ONN 100002487/16843009"
        },
        "mode": {
            "refresh": 60,
            "size": {
                "height": 1080,
                "width": 1920
            }
        },
        "overscan": 0,
        "pos": {
            "x": 0,
            "y": 0
        },
        "primary": false,
        "rgbrange": 0,
        "rotation": 1,
        "scale": 1,
        "vrrpolicy": 0
    },
    {
        "enabled": true,
        "id": "80171eaf8780afb986359257f6ce666e",
        "metadata": {
            "fullname": "xrandr-HP Inc.-HP VH240a-6CM02801WK",
            "name": "HP Inc. HP VH240a/6CM02801WK"
        },
        "mode": {
            "refresh": 60,
            "size": {
                "height": 1080,
                "width": 1920
            }
        },
        "overscan": 0,
        "pos": {
            "x": 1920,
            "y": 0
        },
        "primary": true,
        "rgbrange": 0,
        "rotation": 1,
        "scale": 1,
        "vrrpolicy": 0
    }
]

And the inside the outputs folder, there are two other files, 4b4ebb4206f61e68a1cefc3b07556a7f:
{
    "id": "4b4ebb4206f61e68a1cefc3b07556a7f",
    "metadata": {
        "fullname": "xrandr-100002487-16843009",
        "name": "ONN 100002487/16843009"
    },
    "mode": {
        "refresh": 60,
        "size": {
            "height": 1080,
            "width": 1920
        }
    },
    "overscan": 0,
    "rgbrange": 0,
    "rotation": 1,
    "scale": 1,
    "vrrpolicy": 0
}

and 80171eaf8780afb986359257f6ce666e:
{
    "id": "80171eaf8780afb986359257f6ce666e",
    "metadata": {
        "fullname": "xrandr-HP Inc.-HP VH240a-6CM02801WK",
        "name": "HP Inc. HP VH240a/6CM02801WK"
    },
    "mode": {
        "refresh": 60,
        "size": {
            "height": 1080,
            "width": 1920
        }
    },
    "overscan": 0,
    "rgbrange": 0,
    "rotation": 1,
    "scale": 1,
    "vrrpolicy": 0
}

As you can see, it seems like on bootup the system only recognizes 2 monitors (the HP, and ONE of the ONN ones) and its not until I open up settings that it finally sees the other, but again these changes don't actually persist.

One more peculiar thing is that I have the task manger panels on all 3 of my monitos, and I've got the: "Show only tasks: From current screen, and From current desktop" checked. 
No problems on the HP monitor, that one shows the right taks. No problems on the ONN monitor on the right, that one also shows the right tasks. But the third monitor (the one on the left that wasn't originally detected) doesn't show its unique tasks, it shows the tasks of the center HP monitor.

I suspect this is because it defaults to the main monitor, but I'm not sure. Some times it works properly, but most times it doesn't.
Comment 11 Nate Graham 2022-11-10 18:02:49 UTC
The originally described issue made by the author should be fixed as of Plasma 5.26.

For everyone else, please file new bug reports, since multi-screen issues usually have subtly different root causes, and need their own  comment threads to figure out what exactly is going wrong. Thanks a lot!