Bug 485353 - kwin_wayland forgets the highdpi scaling whenever you connect a new monitor
Summary: kwin_wayland forgets the highdpi scaling whenever you connect a new monitor
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen
: 486884 490608 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-04-11 01:11 UTC by Thiago Macieira
Modified: 2024-09-05 13:27 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.5
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Macieira 2024-04-11 01:11:40 UTC
SUMMARY
Whenever you connect a new monitor (not a previously connected one), KWin forgets the scaling for the monitor it is in. The physical size of existing monitors does not change when you connect new outputs

STEPS TO REPRODUCE
1. Configure one monitor to something other than 100% (for example, laptop display panel to 200% or 250%)
2. Connect another monitor

OBSERVED RESULT
The first-connected monitor goes back to 100%

EXPECTED RESULT
The first-connected monitor's scaling remains as it was configured

SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2024-04-11 17:12:59 UTC
Is this reproducible in a new clean user account, by any chance?
Comment 2 Thiago Macieira 2024-04-12 00:52:11 UTC
(In reply to Nate Graham from comment #1)
> Is this reproducible in a new clean user account, by any chance?

Will test and let you know. This problem definitely happens on two different laptops that I've recently migrated to Wayland... but both have the same history of $HOME going back to 2015.
Comment 3 Thiago Macieira 2024-04-12 04:10:43 UTC
No, I've just tried with a new account and the same problem happens.
Comment 4 Zamundaaa 2024-04-17 16:15:24 UTC
Can reproduce, but only if I first log into Xorg with the monitor connected once before - in that case the KScreen fallback code loads the config stored by KScreen for Xorg, which doesn't have a scale factor for the outputs, so it defaults to 100%. We kinda need bug 479952 to fix that nicely.

When you reproduced this issue with a new user account, did you also log into Xorg first, or does it even happen if you never do that?
Comment 5 Thiago Macieira 2024-04-17 23:31:28 UTC
(In reply to Zamundaaa from comment #4)
> When you reproduced this issue with a new user account, did you also log
> into Xorg first, or does it even happen if you never do that?

I had used the account first with X, but I did go and delete all the config files before trying this. I may have missed something, though. Which file is this stored in? ~/.local/share/kscreen/ ?
Comment 6 Thiago Macieira 2024-04-18 01:57:15 UTC
I must have made a mistake in testing previously. After ensuring ~/.local/share/kscreen was deleted, logging out and back in again, kwin_wayland does not forget the laptop screen's settings when connecting the external monitor.

PS: in kcm_display, you can't type %
Comment 7 Zamundaaa 2024-04-19 13:25:14 UTC
okay, cool, then the problem is exclusively in KWin's fallback code for KScreen configs.
Comment 8 Bug Janitor Service 2024-04-22 20:52:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5637
Comment 9 Zamundaaa 2024-04-23 11:50:11 UTC
Git commit 7949032411153ebf9d87b0e936b1bc288df12b38 by Xaver Hugl.
Committed on 23/04/2024 at 11:41.
Pushed by zamundaaa into branch 'master'.

outputconfigurationstore: don't overwrite output settings with kscreen configs

The existing code overwrites all per-output data with the config from KScreen
every time an output config is found that isn't in the KWin data base yet.
That causes problems like the scale being reset to 1.0 if the user logged
into Xorg before, or resetting it to whatever scale KScreen had saved on
Wayland, which isn't much better.

Instead of doing that, use the KScreen config as inspiration for some specific
output settings, instead of copying it outright. It's not ideal, but it's
better than overwriting settings the user has explicitly set up

M  +24   -15   src/outputconfigurationstore.cpp

https://invent.kde.org/plasma/kwin/-/commit/7949032411153ebf9d87b0e936b1bc288df12b38
Comment 10 Zamundaaa 2024-04-23 12:49:41 UTC
Git commit 10af8375ee8cfb822b5c6bbee3edc9ed93e5fe1a by Xaver Hugl.
Committed on 23/04/2024 at 12:32.
Pushed by zamundaaa into branch 'Plasma/6.0'.

outputconfigurationstore: don't overwrite output settings with kscreen configs

The existing code overwrites all per-output data with the config from KScreen
every time an output config is found that isn't in the KWin data base yet.
That causes problems like the scale being reset to 1.0 if the user logged
into Xorg before, or resetting it to whatever scale KScreen had saved on
Wayland, which isn't much better.

Instead of doing that, use the KScreen config as inspiration for some specific
output settings, instead of copying it outright. It's not ideal, but it's
better than overwriting settings the user has explicitly set up


(cherry picked from commit 7949032411153ebf9d87b0e936b1bc288df12b38)

M  +24   -15   src/outputconfigurationstore.cpp

https://invent.kde.org/plasma/kwin/-/commit/10af8375ee8cfb822b5c6bbee3edc9ed93e5fe1a
Comment 11 Zamundaaa 2024-07-21 17:24:41 UTC
*** Bug 486884 has been marked as a duplicate of this bug. ***
Comment 12 Zamundaaa 2024-09-05 13:27:00 UTC
*** Bug 490608 has been marked as a duplicate of this bug. ***