gnome-shell monitors.xml config validator fails adjacent check for screens saved with 'Fractional Scaling'
Affected version
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
GNOME Shell 3.36.1
Bug summary
Gome-shell monitors.xml config validator fails to validate config saved by Gnome settings with Fractional Scaling on:
Apr 25 13:28:28 xxx systemd[1798]: Starting GNOME Shell on X11...
Apr 25 13:28:28 xxx gnome-shell[10304]: Enabling experimental feature 'x11-randr-fractional-scaling'
Apr 25 13:28:28 xxx /usr/lib/gdm3/gdm-x-session[10123]: (II) AMDGPU(0): EDID vendor "GSM", prod id 23305
...
Apr 25 13:28:28 xxx gnome-shell[10304]: Failed to read monitors config file '/home/xxx/.config/monitors.xml': Logical monitors not adjacent
Steps to reproduce
- Need multiple displays to reproduce
- Go to Display Settings
- Enable Fractional scaling, for one of the screens, and set scaling to a different value than the other one.
- Restart gnome-shell
- Settings switched to default ones, as gnome-shell can't validate monitors.xml
What happened
Gnome-shell can't apply monitors.xml config as it can't validate it with fractional scaling on
What did you expect to happen
Scaled settings validated, loaded and remain the same across gnome-shell restarts
Relevant logs, screenshots, screencasts etc.
Saved 'Scaled' monitors.xml, which not passing validation:
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<scale>1</scale>
<monitor>
<monitorspec>
<connector>HDMI-A-1</connector>
<vendor>ACI</vendor>
<product>ASUS PB278</product>
<serial>D3LMTF056504</serial>
</monitorspec>
<mode>
<width>2560</width>
<height>1440</height>
<rate>59.950550079345703</rate>
</mode>
</monitor>
</logicalmonitor>
<logicalmonitor>
<x>5120</x>
<y>0</y>
<scale>1.5</scale>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>DisplayPort-1</connector>
<vendor>ACI</vendor>
<product>ASUS PB287Q</product>
<serial>0x0001ecd2</serial>
</monitorspec>
<mode>
<width>3840</width>
<height>2160</height>
<rate>59.996623992919922</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
As you can see first one resolution is 2560x1440, but the second one by position starts at x=5120, so 2560x2, as the second one is saved with 1.5 scale. But gnome-shell probably expects them to be adjacent, so expects x=2560
So, when gnome-shell starts it looks like we are failing to pass the adjacent check. And that's exactly what it's saying:
Apr 25 13:28:28 xxx gnome-shell[10304]: Failed to read monitors config file '/home/xxx/.config/monitors.xml': Logical monitors not adjacent
To verify that I made x=2560 in monitors.xml and restarted gnome-shell, all scaling remained in place as they saved and no errors from gnome-shell anymore, but the left screen is half overridden by right one (which is exactly how to position specified now for the scaled screen).
The modified version of monitors.xml, passing validation:
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<scale>1</scale>
<monitor>
<monitorspec>
<connector>HDMI-A-1</connector>
<vendor>ACI</vendor>
<product>ASUS PB278</product>
<serial>D3LMTF056504</serial>
</monitorspec>
<mode>
<width>2560</width>
<height>1440</height>
<rate>59.950550079345703</rate>
</mode>
</monitor>
</logicalmonitor>
<logicalmonitor>
<x>2560</x>
<y>0</y>
<scale>1.5</scale>
<primary>yes</primary>
<monitor>
<monitorspec>
<connector>DisplayPort-1</connector>
<vendor>ACI</vendor>
<product>ASUS PB287Q</product>
<serial>0x0001ecd2</serial>
</monitorspec>
<mode>
<width>3840</width>
<height>2160</height>
<rate>59.996623992919922</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
So it looks like config validator in gnome-shell needs to be fixed to behave differently when logical monitors are scaled.