Bug 389665 - Rotating screen doesn't work on wayland
Summary: Rotating screen doesn't work on wayland
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (show other bugs)
Version: 5.13.4
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Roman Gilg
URL:
Keywords:
: 397751 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-31 00:28 UTC by Kamil Piwowarski
Modified: 2020-03-04 19:49 UTC (History)
26 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.19
mgraesslin: Wayland+
mgraesslin: X11-


Attachments
screenshot 1 (2.39 MB, image/png)
2018-01-31 00:29 UTC, Kamil Piwowarski
Details
screenshot 2 (1.87 MB, image/png)
2018-01-31 00:29 UTC, Kamil Piwowarski
Details
qdbus org.kde.KWin /KWin supportInfromation (default) (5.68 KB, text/plain)
2018-01-31 01:30 UTC, Kamil Piwowarski
Details
qdbus org.kde.KWin /KWin supportInfromation (rotated) (5.68 KB, text/plain)
2018-01-31 01:31 UTC, Kamil Piwowarski
Details
log of https://phabricator.kde.org/D16630 (497.18 KB, text/x-log)
2018-11-07 08:52 UTC, Ronald van Haren
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kamil Piwowarski 2018-01-31 00:28:13 UTC
Steps to reproduce:
1. Have 3 screens. Run wayland session.
2. Open kscreen and rotate one and then two external screens.
3. Screen position changes but the are not rotated.
Comment 1 Kamil Piwowarski 2018-01-31 00:29:27 UTC
Created attachment 110248 [details]
screenshot 1
Comment 2 Kamil Piwowarski 2018-01-31 00:29:52 UTC
Created attachment 110249 [details]
screenshot 2
Comment 3 David Edmundson 2018-01-31 01:20:41 UTC
Please include the output of 

qdbus org.kde.kwin /KWin supportInformation
Comment 4 Kamil Piwowarski 2018-01-31 01:30:49 UTC
Created attachment 110252 [details]
qdbus org.kde.KWin /KWin supportInfromation (default)
Comment 5 Kamil Piwowarski 2018-01-31 01:31:05 UTC
Created attachment 110253 [details]
qdbus org.kde.KWin /KWin supportInfromation (rotated)
Comment 6 David Edmundson 2018-01-31 01:43:56 UTC
Pasting relevant bit inline:

> Atomic Mode Setting: true
Comment 7 Martin Flöser 2018-01-31 05:21:25 UTC
Can you try whether 180 degrees work?
Comment 8 Kamil Piwowarski 2018-01-31 07:40:16 UTC
Yes! Only upside down option (180 degrees) is working.
Comment 9 Martin Flöser 2018-01-31 17:21:41 UTC
nod, that's kind of expected. Or better said: it's something I also experienced.

We rotate the layer, but that seem to fail for 90 degrees.
Comment 10 Michael D 2018-02-16 01:16:26 UTC
I've the same issue--can't rotate 90 degree, but can 180 degrees. Automatic screen rotation doesn't work, though, and if I click on the icon in the tray, nothing happens.

Another thing: after rotating the screen 180, then 90, then back to normal, I lost input to gtk apps such as firefox. Not sure if they're related though, since I haven't tried to reproduce it.
Comment 11 Crazy_Fox 2018-03-22 11:53:53 UTC
The same for me. Debian Testing,
Comment 12 Daniele Laudani 2018-04-09 07:47:04 UTC
This also happens on single monitor setups, and only under wayland. Plasma rotates by 180 according to rotation sensor, but fails to rotate by 90/270°. I am using Kubuntu 18.04 with KDE 5.12.
Comment 13 Greg White 2018-04-23 15:05:47 UTC
Sam here.  Attempts to rotate 270 hangs the session and then it will fail to start afterwards.  This is with latest Mesa and and AMD RX580.
Comment 14 Alexander Mentyu 2018-05-17 21:06:32 UTC
Can reproduce - both 90 deg rotations doesn't work in single monitor setup

KWin version: 5.12.5
Qt Version: 5.10.1
Qt compile version: 5.10.1
XCB compile version: 1.13

Operation Mode: Xwayland

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_INPUT: yes
HAVE_DRM: yes
HAVE_GBM: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: The X.Org Foundation
Vendor Release: 11906000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme: 
Blur: 0
onAllDesktopsAvailable: false
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 9
decorationButtonsRight: 6, 3, 4, 5
borderSize: 3
gridUnit: 10
font: Noto Sans,10,-1,0,50,0,0,0,0,0,Regular
smallSpacing: 2
largeSpacing: 10

Platform
==========
Name: DRM
Active: true
Atomic Mode Setting: true

Options
=======
focusPolicy: 0
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
legacyFullscreenSupport: false
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 30
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 30
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 31
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
inactiveTabsSkipTaskbar: false
autogroupSimilarWindows: false
autogroupInForeground: true
compositingMode: 1
useCompositing: true
compositingInitialized: true
hiddenPreviews: 1
glSmoothScale: 2
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: false
glStrictBindingFollowsDriver: true
glCoreProfile: false
glPreferBufferSwap: 101
glPlatformInterface: 2
windowsBlockCompositing: true

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  no
Number of Screens: 1

Screen 0:
---------
Name: B140RTN03.0 eDP-1-unknown
Geometry: 0,0,1600x900
Scale: 1
Refresh Rate: 60


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile 
OpenGL version string: 3.0 Mesa 18.0.3
OpenGL platform interface: EGL
OpenGL shading language version string: 1.30
Driver: Intel
GPU class: Haswell
OpenGL version: 3.0
GLSL version: 1.30
Mesa version: 18.0.3
Linux kernel version: 4.14.40
Direct rendering: Requires strict binding: no
GLSL shaders:  yes
Texture NPOT support:  yes
Virtual Machine:  no
OpenGL 2 Shaders are used
Painting blocks for vertical retrace:  no

Loaded Effects:
---------------
zoom
kwin4_effect_maximize
kwin4_effect_dialogparent
kwin4_effect_morphingpopups
kwin4_effect_translucency
kwin4_effect_windowaperture
kwin4_effect_frozenapp
kwin4_effect_login
kwin4_effect_logout
kwin4_effect_fade
slidingpopups
slide
screenshot
minimizeanimation
desktopgrid
colorpicker
presentwindows
highlightwindow
blur
contrast
startupfeedback
screenedge
kscreen

Currently Active Effects:
-------------------------
blur
contrast

Effect Settings:
----------------
zoom:
zoomFactor: 1.2
mousePointer: 0
mouseTracking: 0
enableFocusTracking: false
followFocus: true
focusDelay: 350
moveFactor: 20
targetZoom: 1

kwin4_effect_maximize:

kwin4_effect_dialogparent:

kwin4_effect_morphingpopups:

kwin4_effect_translucency:

kwin4_effect_windowaperture:

kwin4_effect_frozenapp:

kwin4_effect_login:

kwin4_effect_logout:

kwin4_effect_fade:

slidingpopups:
fadeInTime: 150
fadeOutTime: 250

slide:

screenshot:

minimizeanimation:

desktopgrid:
zoomDuration: 300
border: 10
desktopNameAlignment: 0
layoutMode: 0
customLayoutRows: 2
usePresentWindows: true

colorpicker:

presentwindows:
layoutMode: 0
showCaptions: true
showIcons: true
doNotCloseWindows: false
ignoreMinimized: false
accuracy: 20
fillGaps: true
fadeDuration: 150
showPanel: false
leftButtonWindow: 1
rightButtonWindow: 2
middleButtonWindow: 0
leftButtonDesktop: 2
middleButtonDesktop: 0
rightButtonDesktop: 0

highlightwindow:

blur:
blurRadius: 12
cacheTexture: false

contrast:

startupfeedback:
type: 1

screenedge:

kscreen:
Comment 15 Alexander Mentyu 2018-08-22 16:35:37 UTC
*** Bug 397751 has been marked as a duplicate of this bug. ***
Comment 16 Roman Šmakal 2018-09-09 09:07:38 UTC
I can also have same issue with intel GPU. Would be great if someone could take look and fix this, because you dont want convertible laptop without ability to rotate.
Comment 17 selene.neko 2018-09-10 06:20:27 UTC
Same here. Wayland cannot rotate my secondary screen 270° with Intel GPU. It would be nice to fix this or I had no choice but to stick with X11.
Comment 18 Luiz Angelo De Luca 2018-10-01 18:30:08 UTC
weston does rotate nicely.

For me, it's not simply a missing feature. The failed rotation makes plasma unstable, eventually crashing. The first time I try it passes the splash screen.
The second time, it normally never exits splash animation. VGA crashes and I need to sysrq-reboot.

I'm using kwin5-5.13.5 with radeon from kernel 4.18.8-1-default
Comment 19 Martin Flöser 2018-11-04 13:06:50 UTC
I created a patch to support rotating the CRTC instead of the layer. Unfortunately my system reports no supported rotations on the CRTC. It would be appreciated if someone could test whether my patch improves the situation: https://phabricator.kde.org/D16630
Comment 20 selene.neko 2018-11-04 14:04:46 UTC
(In reply to Martin Flöser from comment #19)
> I created a patch to support rotating the CRTC instead of the layer.
> Unfortunately my system reports no supported rotations on the CRTC. It would
> be appreciated if someone could test whether my patch improves the
> situation: https://phabricator.kde.org/D16630

I tested the patch, but the problem is still there.
(I turned off the KDE debug messages and couldn't find the way to turn on them again, so I'm not sure whether my system supports CRTC rotation.)
Comment 21 Martin Flöser 2018-11-04 15:55:59 UTC
(In reply to selene.neko from comment #20)
> (In reply to Martin Flöser from comment #19)
> > I created a patch to support rotating the CRTC instead of the layer.
> > Unfortunately my system reports no supported rotations on the CRTC. It would
> > be appreciated if someone could test whether my patch improves the
> > situation: https://phabricator.kde.org/D16630
> 
> I tested the patch, but the problem is still there.
> (I turned off the KDE debug messages and couldn't find the way to turn on
> them again, so I'm not sure whether my system supports CRTC rotation.)

Can you rotate on X11?
Comment 22 selene.neko 2018-11-04 16:05:31 UTC
(In reply to Martin Flöser from comment #21)
> (In reply to selene.neko from comment #20)
> > (In reply to Martin Flöser from comment #19)
> > > I created a patch to support rotating the CRTC instead of the layer.
> > > Unfortunately my system reports no supported rotations on the CRTC. It would
> > > be appreciated if someone could test whether my patch improves the
> > > situation: https://phabricator.kde.org/D16630
> > 
> > I tested the patch, but the problem is still there.
> > (I turned off the KDE debug messages and couldn't find the way to turn on
> > them again, so I'm not sure whether my system supports CRTC rotation.)
> 
> Can you rotate on X11?

Yes.
Main screen is not rotated & Secondary screen rotate 270°.
Comment 23 Luiz Angelo De Luca 2018-11-05 14:51:14 UTC
Can't rotate logic be copied from Weston? It does rotate nicely both screens, although I only know how to rotate it using config, not after it is up and running.
Comment 24 Ronald van Haren 2018-11-07 08:51:34 UTC
(In reply to Martin Flöser from comment #19)
> I created a patch to support rotating the CRTC instead of the layer.
> Unfortunately my system reports no supported rotations on the CRTC. It would
> be appreciated if someone could test whether my patch improves the
> situation: https://phabricator.kde.org/D16630

Thanks for the work. If I'm reading this correct my system supports rotation on the CRTC (I think this is also what mutter uses where rotation works), but rotation in 90/270 degrees still doesn't work.

I'll attach the journal output next (it should contain a 180 (succeeded) and 90 (failed) degree rotation if I didn't mess up.
Comment 25 Ronald van Haren 2018-11-07 08:52:46 UTC
Created attachment 116143 [details]
log of https://phabricator.kde.org/D16630
Comment 26 Martin Flöser 2018-11-07 09:07:53 UTC
(In reply to Ronald van Haren from comment #25)
> Created attachment 116143 [details]

Given the log your CRTCs do not support rotation (or my patch is broken). But some of your planes support all rotations, some only partially. Unfortunately it's tricky to combine all the information to figure out whether your setup should support rotation. It shows we need to add better debug info to drm platform :-)
Comment 27 Michael D 2018-11-09 07:36:51 UTC
Automatic rotation works fine on Fedora gnome for me, so might be worth looking into how they do it.
Comment 28 Greg White 2019-02-12 14:53:38 UTC
Just noting that this is still broken in 5.15.
Comment 29 deadite66 2019-02-15 07:17:09 UTC
Broken for me too, when i tried to rotate the screen looks the same but the mouse can only move around half the screen and none of the UI is clickable.

using a vega 64, kernel 4.20.7 and latest plasma on Arch Linux.
Comment 30 ikidd3123 2019-03-04 20:39:32 UTC
180* rotation failing on secondary screen on 5.15.2 with Arch 4.20.13.  Mouse pointer and functional layout rotate, but the actual display does not.  IE: If the button I'm trying to hit would be in a certain spot like the bottom left corner, I can hit it if I blindly aim for that spot, but the button actually displays upside down in the top right corner. 

Using HDMI output for secondary screen on a Ryzen 2600U laptop with integrated Vega mobile graphics.
Comment 31 Bráulio Barros de Oliveira 2019-08-02 21:57:30 UTC
is this going to be fixed anytime soon???
Comment 32 pavel kropitz 2019-08-05 13:42:42 UTC
> is this going to be fixed anytime soon???

maybe - https://phabricator.kde.org/D19860
Comment 33 Oded Arbel 2019-12-08 17:51:55 UTC
Still an issue with KWin 5.17.80+p19.10+git20191203.2043-0 from KCI.

This issue is the main reason I'm still using X11.

Regarding the discussion in https://phabricator.kde.org/D19860 (I'm commenting here because I'm not sure if users commenting about their experiences are welcome in phabricator), I don't think that supporting desktop effects should block this non-eye-candy change - especially in regards to blur - which already works very partially in X11 and doesn't behave well on rotated screens there either.
Comment 34 David Edmundson 2020-02-28 12:26:53 UTC
Git commit 8180662233b92f58c28523d178030b6f007b84f5 by David Edmundson, on behalf of Roman Gilg.
Committed on 28/02/2020 at 12:22.
Pushed by davidedmundson into branch 'master'.

[platforms/drm] Introduce Gl post-process output rotations

Summary:
In case the hardware is not able to rotate the output for the configured
rotation value do this rotation in a post-process step.

For that rendering the current view into a separate framebuffer bound to a
texture that then gets sampled to the default framebuffer in an additional
rendering pass through a simple shader rotating it.

This allows us to leave the Effects system and internal model-view-projection
matrix untouched. The rotation in the post-processing step is isolated.
FIXED-IN: 5.18

Test Plan: With KScreen all rotations work.

Reviewers: #kwin

Subscribers: davidedmundson, PureTryOut, z3ntu, zzag, univerz, kwin

Tags: #kwin

Maniphest Tasks: T6106

Differential Revision: https://phabricator.kde.org/D25907

M  +7    -4    plugins/platforms/drm/drm_output.cpp
M  +160  -3    plugins/platforms/drm/egl_gbm_backend.cpp
M  +16   -1    plugins/platforms/drm/egl_gbm_backend.h

https://commits.kde.org/kwin/8180662233b92f58c28523d178030b6f007b84f5
Comment 35 Luiz Angelo De Luca 2020-03-04 17:27:58 UTC
The fix got into kwin/master. Will it be backported to 5.18 branch?
Comment 36 David Edmundson 2020-03-04 19:49:01 UTC
>Will it be backported to 5.18 branch?

no