GNOME Bugzilla – Bug 787801
Mutter should delay applying accelerometer orientation changes when its VT is not focussed
Last modified: 2021-07-05 13:49:06 UTC
I've been running some tests of gnome 3.26 on a tablet with an accelerometer. There are several issues causing accelerometer triggered rotation to not work well. I've patches for most of these, I'm still debugging one more issues I will open another bug with the patches once I've debugged this last issue. While working on this I've noticed another problem for which I need some input to help fix it. When logged in as an user and triggering rotation changes by moving the tablet around its axis, the journal shows the following errors: sep 17 19:52:12 localhost.localdomain gnome-shell[1343]: Failed to apply DRM plane transform 0: Permission denied Which results in gdm's rotation being out of sync with the accelerometer reported orientation / the user session's orietentation. I believe that the best way to fix this, is to behave as if rotation is locked while the VT on which mutter is running does not have the focus, and to call src/backends/meta-orientation-manager.c: sync_state() when we get the focus back. I know that logind sends a dbus signal on both vt leave and enter, but I don't know where mutter catches this signal and how to hook up to it from meta-orientation-manager.c. Note the same issue more or less applies to the x11 backend too, AFAIK Xrandr calls will fail when called when the Xserver does not have the active vt, but catching the VT changes there is going to be trickier and since gdm normally runs with the native kms backend I'm not sure if fixing this corner case is worth it for the x11 case.
Ok, the other patches I was talking about are now submitted in bug 787836.
The logind property is proxied through org.gnome.SessionManager's SessionIsActive property. mutter is supposed to release the accelerometer when the session is inactive, and take it back when it is. See the LightLevel handling in gnome-settings-daemon/plugins/power.
FWIW VT-related suspend/resume code for wayland happens at: https://git.gnome.org/browse/mutter/tree/src/backends/native/meta-backend-native.c#n677 https://git.gnome.org/browse/mutter/tree/src/backends/native/meta-backend-native.c#n692 https://git.gnome.org/browse/mutter/tree/src/backends/native/meta-launcher.c#n266 But nothing exists for the X11 paths AFAICS. I guess it makes sense to have paused/resumed as generic signals for both backends.
(In reply to Carlos Garnacho from comment #3) > FWIW VT-related suspend/resume code for wayland happens at: > https://git.gnome.org/browse/mutter/tree/src/backends/native/meta-backend- > native.c#n677 > https://git.gnome.org/browse/mutter/tree/src/backends/native/meta-backend- > native.c#n692 > https://git.gnome.org/browse/mutter/tree/src/backends/native/meta-launcher. > c#n266 > > But nothing exists for the X11 paths AFAICS. I guess it makes sense to have > paused/resumed as generic signals for both backends. Thanks, I will take a look at using the pause/resume stuff for the accelerometer triggered orientation. May be a while before I get around to this though ...
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/mutter/-/issues/ Thank you for your understanding and your help.