After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772512 - 90/270 rotation modes don't work on skylake
90/270 rotation modes don't work on skylake
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
unspecified
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2016-10-06 14:05 UTC by Carlos Garnacho
Modified: 2016-10-07 15:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
backends/native: Ignore 90/270 rotation modes announced by DRM (1.68 KB, patch)
2016-10-06 14:06 UTC, Carlos Garnacho
none Details | Review
backends: Check return value after applying DRM plane rotation (1.91 KB, patch)
2016-10-07 14:55 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2016-10-06 14:05:08 UTC
Rotating to 90/270 on skylake is greeted with no UI updates and warnings like this on stderr:

... Failed to set CRTC mode "HxW": No space left on device

I saw this happening when we create a CoglOnscreen/gbm surface with the wrong w/h given the current mode. Making it pass WxH when creating the onscreen fools mutter enough to successfully apply the mode, just to see that besides the obviously wrong stage view size, there is no 90/270 HW rotation applied at all.

TBH I don't know if I interpreted rotation modes wrongly and rotation must be still done client side, but it'd look like a huge departure from how rotate-180 is handled. Or if (gut feeling says it is) it is a broken/untested feature on just-too-recent hardware.

Either way, screen rotation to portrait mode is broken on mutter with skylake HW, I'm attaching a patch that makes us fallback to the GL paths despite drm offering rotate-90/270, to be possibly reverted in the future.
Comment 1 Carlos Garnacho 2016-10-06 14:06:21 UTC
Created attachment 337068 [details] [review]
backends/native: Ignore 90/270 rotation modes announced by DRM

Support for such modes is broken, at least on skylake HW (supposedly
capable of these). Applying the mode fails with:

Failed to set CRTC mode "HxW": No space left on device

This usually happens when mutter creates a CoglOnscreen that doesn't
fit on the CRTC mode. Even after "fixing" this issue, the output has
no rotation despite the DRM 90/270 rotation property being applied.

This means we're ATM better off by doing 90/270 rotation through our
fallback code.
Comment 2 Carlos Garnacho 2016-10-07 14:54:29 UTC
so it seems that drmModeObjectSetProperty() with 90/270 transform property/value fails with "Invalid argument", we can better use that to detect failure to set a mode, and blacklisting the HW property so we handle this gracefully.
Comment 3 Carlos Garnacho 2016-10-07 14:55:09 UTC
Created attachment 337178 [details] [review]
backends: Check return value after applying DRM plane rotation

And blacklist the HW mode so we fallback gracefully to our own paths.
Comment 4 Jonas Ådahl 2016-10-07 15:14:01 UTC
Review of attachment 337178 [details] [review]:

Looks good, only a minor nit: Commit subject should probably say "Use fallback rotation if native failed" or something, since this is the effect we get.
Comment 5 Rui Matos 2016-10-07 15:18:32 UTC
Review of attachment 337178 [details] [review]:

It's unfortunate that when we get a hotplug and _read_current() we'll have to go through this failure again, but this is a bit better anyway
Comment 6 Rui Matos 2016-10-07 15:19:13 UTC
Review of attachment 337178 [details] [review]:

ups
Comment 7 Carlos Garnacho 2016-10-07 15:35:49 UTC
Pushed with the suggested log wording change.