Inverted display if session is started with accelerometer reporting bottom-up rotation
Affected version
Fedora 33 running GNOME version 3.38.1 (affects both XOrg and Wayland).
Bug summary
On Yoga laptops (e.g. 360 degree hinge) that are in "tent mode" when the session starts the display will be rotated inverted. Even if you convert the laptop back to laptop mode the display will still be inverted! In other words the rotation sensor is working correctly but GNOME is disbelieving the result.
Steps to reproduce
-
Boot the laptop in "tent mode" (display folded back on its self so keyboard is behind the display and the system can be used with an external keyboard). The accelerometer will be (correctly) reporting "Has accelerometer (orientation: bottom-up)".
-
gdm will provide a login prompt correctly oriented.
-
Log into the session.
-
Laptop display will be upside down.
-
Convert to normal laptop mode (accelerometer reporting "Accelerometer orientation changed: normal"). The display will likewise rotate so that it still upside down.
What happened
GNOME shell is tracking orientation but is flipping the result before honouring it.
What did you expect to happen
Display should be the correct orientation.
Relevant logs, screenshots, screencasts etc.
I suspect the shell is trying to accommodate broken orientation sensors by assuming that the display is not inverted at login, however this results in correctly working sensors being undermined.
The problem is made worse because the decision whether or not to believe the sensor is revisited when connecting or disconnecting an external monitor and when switching to/from virtual consoles. This means that even it I go to the trouble of undocking my laptop and logging in with the sensor normally oriented then I still end up with a messed up session when I redock it.
Perhaps if gnome-shell decided not to trust the accelerometer then it should at least only do so at login. It is inconvenient that a working sensor is overrules but it is especially disruptive when a user session can flip upside whilst they are working.