Bug 413305 - [Wayland] 100% cpu usage, system lagging, radeon amdgpu
Summary: [Wayland] 100% cpu usage, system lagging, radeon amdgpu
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland
: 412532 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-10-22 08:22 UTC by Méven Car
Modified: 2019-10-29 16:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Méven Car 2019-10-22 08:22:12 UTC
SUMMARY

STEPS TO REPRODUCE
1. Start a plasma Wayland session

OBSERVED RESULT
kwin_wayland uses 1 whole CPU spinning 90-100% making the system laggy 
EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.17.80 (5.18 from source)
KDE Frameworks Version:  5.64 (from source)
Qt Version:  5.12.4

ADDITIONAL INFORMATION

I have two screens and a AMD Radeon RX 560 GPU using amdgpu driver.
The display painted zone effect show the whole screen is repainted all the time.

It seems the issue is that the Compositing Type is QPainter.

Trace of sudo gdb -pid=`pidof kwin_wayland`

0x00007f76ddd2ab5e in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
(gdb) bt
#0  0x00007f76ddd2ab5e in  () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#1  0x00007f76ddfe1565 in  () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#2  0x00007f76ddffb601 in QPainter::drawImage(QRectF const&, QImage const&, QRectF const&, QFlags<Qt::ImageConversionFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#3  0x00007f76d6455e5b in QPainter::drawImage(QRect const&, QImage const&, QRect const&, QFlags<Qt::ImageConversionFlag>) (flags=..., sourceRect=<synthetic pointer>..., image=..., targetRect=<synthetic pointer>..., this=0x559d0e6feda0)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qrect.h:269
#4  0x00007f76d6455e5b in KWin::SceneQPainter::Window::performPaint(int, QRegion, KWin::WindowPaintData) (this=this@entry=0x559d0ea4b670, mask=mask@entry=10, region=..., data=...) at /home/meven/kde/src/kwin/plugins/scenes/qpainter/scene_qpainter.cpp:297
#5  0x00007f76e0cda05d in KWin::Scene::finalDrawWindow(KWin::EffectWindowImpl*, int, QRegion, KWin::WindowPaintData&) (this=this@entry=0x559d0e7197c0, w=w@entry=0x559d0eab8b80, mask=mask@entry=10, region=..., data=...) at /home/meven/kde/src/kwin/effects.h:655
#6  0x00007f76e0c3a2e7 in KWin::EffectsHandlerImpl::drawWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) (this=this@entry=0x559d0ea9e090, w=w@entry=0x559d0eab8b80, mask=mask@entry=10, region=..., data=...) at /home/meven/kde/src/kwin/effects.cpp:486
#7  0x00007f76e0cd446f in KWin::Scene::finalPaintWindow(KWin::EffectWindowImpl*, int, QRegion, KWin::WindowPaintData&) (this=this@entry=0x559d0e7197c0, w=w@entry=0x559d0eab8b80, mask=mask@entry=10, region=..., data=...) at /home/meven/kde/src/kwin/scene.cpp:612
#8  0x00007f76e0c3a120 in KWin::EffectsHandlerImpl::paintWindow(KWin::EffectWindow*, int, QRegion, KWin::WindowPaintData&) (this=this@entry=0x559d0ea9e090, w=0x559d0eab8b80, mask=mask@entry=10, region=..., data=...) at /home/meven/kde/src/kwin/effects.cpp:449
#9  0x00007f76e0cd9f06 in KWin::Scene::paintWindow(KWin::Scene::Window*, int, QRegion, KWin::WindowQuadList) (this=this@entry=0x559d0e7197c0, w=0x559d0ea4b670, mask=10, region=..., quads=...) at /home/meven/kde/src/kwin/scene.cpp:484
#10 0x00007f76e0cd7655 in KWin::Scene::paintSimpleScreen(int, QRegion) (this=this@entry=0x559d0e7197c0, orig_mask=orig_mask@entry=8, region=...) at /home/meven/kde/src/kwin/libkwineffects/kwineffects.h:2542
#11 0x00007f76e0cd94e0 in KWin::Scene::finalPaintScreen(int, QRegion, KWin::ScreenPaintData&) (this=this@entry=0x559d0e7197c0, mask=mask@entry=8, region=..., data=...) at /home/meven/kde/src/kwin/scene.cpp:199
#12 0x00007f76e0c39e72 in KWin::EffectsHandlerImpl::paintScreen(int, QRegion, KWin::ScreenPaintData&) (this=this@entry=0x559d0ea9e090, mask=8, region=..., data=...) at /home/meven/kde/src/kwin/effects.cpp:406
#13 0x00007f76e0cd9193 in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, QMatrix4x4 const&, QRect const&)
    (this=this@entry=0x559d0e7197c0, mask=mask@entry=0x7fff437e72d4, damage=..., repaint=..., updateRegion=updateRegion@entry=0x7fff437e72e0, validRegion=validRegion@entry=0x7fff437e72e8, projection=..., outputGeometry=...) at /home/meven/kde/src/kwin/scene.cpp:149
#14 0x00007f76d64535c0 in KWin::SceneQPainter::paint(QRegion, QList<KWin::Toplevel*>) (this=this@entry=0x559d0e7197c0, damage=..., toplevels=...) at /usr/include/x86_64-linux-gnu/qt5/QtGui/qmatrix4x4.h:358
#15 0x00007f76e0bfdfd1 in KWin::Compositor::performCompositing() (this=0x559d0e7fa360) at /home/meven/kde/src/kwin/composite.cpp:693
#16 0x00007f76d7e8d6bd in drmHandleEvent () at /usr/lib/x86_64-linux-gnu/libdrm.so.2
#17 0x00007f76d7ee3713 in KWin::DrmBackend::<lambda()>::operator() (__closure=<optimized out>) at /home/meven/kde/src/kwin/plugins/platforms/drm/drm_backend.cpp:278

qdbus org.kde.KWin /KWin supportInformation:

Version
=======
KWin version: 5.17.80
Qt Version: 5.12.4
Qt compile version: 5.12.4
XCB compile version: 1.13.1

Operation Mode: Xwayland

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

X11
===
Vendor: The X.Org Foundation
Vendor Release: 12005000
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: 
Plugin recommends border size: None
Blur: 0
onAllDesktopsAvailable: false
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 0
gridUnit: 10
font: Noto Sans,10,-1,5,50,0,0,0,0,0,Regular
smallSpacing: 2
largeSpacing: 10

Platform
==========
Name: DRM
Active: true
Atomic Mode Setting: true
Using EGL Streams: false

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
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 28
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 28
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 28
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: true
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
compositingMode: 1
useCompositing: true
hiddenPreviews: 1
glSmoothScale: 1
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: true
glStrictBindingFollowsDriver: true
glCoreProfile: true
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: 2

Screen 0:
---------
Name: DEL DP-1-DELL U2515H/9X2VY69209CL
Geometry: 0,0,2560x1440
Scale: 1
Refresh Rate: 59.951

Screen 1:
---------
Name: DEL DVI-D-1-DELL 1908FP/UW5387CD2TJH
Geometry: 2560,0,1280x1024
Scale: 1
Refresh Rate: 60.02


Compositing
===========
Compositing is active
Compositing Type: QPainter

Loaded Effects:
---------------
zoom
desktopgrid
presentwindows
highlightwindow
screenedge
kscreen

Currently Active Effects:
-------------------------

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

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

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

highlightwindow:

screenedge:

kscreen:
Comment 1 David Edmundson 2019-10-22 08:51:35 UTC
>SceneQPainter

That explains most of it. This is the fallback if GL setup fails.

Rather than optimise the qpainter path, we should try and find out why your GL setup fails.

can you turn on the various debug logs for kwin and get output of them?
Comment 2 Méven Car 2019-10-22 09:51:59 UTC
Beginning ~/.local/share/sddm/wayland-session.log  with export QT_LOGGING_RULES="kwin_*.debug=true" :

dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.systemd1 was not provided by any .service files
No backend specified through command line argument, trying auto resolution
kwin_core: Platform does not support input, enforcing libinput support
kwin_core: KGlobalAcceld inited
kwin_core: Session path: "/org/freedesktop/login1/session/_312"
kwin_core: "logind"  seat: "seat0" / "/org/freedesktop/login1/seat/seat0"
kwin_core: Gained session control
kwin_core: Adding mode 1: QSize(2560, 1440) [59951]
kwin_core: Adding mode 2: QSize(2048, 1152) [60000]
kwin_core: Adding mode 3: QSize(1920, 1200) [59885]
kwin_core: Adding mode 4: QSize(1920, 1080) [60000]
kwin_core: Adding mode 5: QSize(1920, 1080) [60000]
kwin_core: Adding mode 6: QSize(1920, 1080) [59940]
kwin_core: Adding mode 7: QSize(1920, 1080) [50000]
kwin_core: Adding mode 8: QSize(1920, 1080) [30000]
kwin_core: Adding mode 9: QSize(1920, 1080) [29970]
kwin_core: Adding mode 10: QSize(1920, 1080) [25000]
kwin_core: Adding mode 11: QSize(1920, 1080) [24000]
kwin_core: Adding mode 12: QSize(1920, 1080) [23976]
kwin_core: Adding mode 13: QSize(1600, 1200) [60000]
kwin_core: Adding mode 14: QSize(1680, 1050) [59954]
kwin_core: Adding mode 15: QSize(1280, 1024) [75025]
kwin_core: Adding mode 16: QSize(1280, 1024) [60020]
kwin_core: Adding mode 17: QSize(1440, 900) [59951]
kwin_core: Adding mode 18: QSize(1200, 960) [59987]
kwin_core: Adding mode 19: QSize(1280, 800) [59951]
kwin_core: Adding mode 20: QSize(1152, 864) [75000]
kwin_core: Adding mode 21: QSize(1280, 720) [60000]
kwin_core: Adding mode 22: QSize(1280, 720) [60000]
kwin_core: Adding mode 23: QSize(1280, 720) [59940]
kwin_core: Adding mode 24: QSize(1280, 720) [50000]
kwin_core: Adding mode 25: QSize(1024, 768) [75029]
kwin_core: Adding mode 26: QSize(1024, 768) [60004]
kwin_core: Adding mode 27: QSize(800, 600) [75000]
kwin_core: Adding mode 28: QSize(800, 600) [60317]
kwin_core: Adding mode 29: QSize(720, 576) [50000]
kwin_core: Adding mode 30: QSize(720, 480) [60000]
kwin_core: Adding mode 31: QSize(720, 480) [60000]
kwin_core: Adding mode 32: QSize(720, 480) [59940]
kwin_core: Adding mode 33: QSize(720, 480) [59940]
kwin_core: Adding mode 34: QSize(720, 480) [59940]
kwin_core: Adding mode 35: QSize(640, 480) [75000]
kwin_core: Adding mode 36: QSize(640, 480) [60000]
kwin_core: Adding mode 37: QSize(640, 480) [59940]
kwin_core: Adding mode 38: QSize(640, 480) [59940]
kwin_core: Adding mode 39: QSize(720, 400) [70082]
kwin_core: Adding mode 1: QSize(1280, 1024) [60020]
kwin_core: Adding mode 2: QSize(1280, 1024) [75025]
kwin_core: Adding mode 3: QSize(1280, 800) [60020]
kwin_core: Adding mode 4: QSize(1152, 864) [75000]
kwin_core: Adding mode 5: QSize(1280, 720) [60020]
kwin_core: Adding mode 6: QSize(1024, 768) [75029]
kwin_core: Adding mode 7: QSize(1024, 768) [60004]
kwin_core: Adding mode 8: QSize(800, 600) [75000]
kwin_core: Adding mode 9: QSize(800, 600) [60317]
kwin_core: Adding mode 10: QSize(640, 480) [75000]
kwin_core: Adding mode 11: QSize(640, 480) [59940]
kwin_core: Adding mode 12: QSize(720, 400) [70082]
kwin_core: Configured compositor not supported by Platform. Falling back to defaults
kwin_core: Instantiated compositing plugin: "SceneQPainter"
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
glamor: 'wl_drm' not supported
Missing Wayland requirements for glamor GBM backend
Failed to initialize glamor, falling back to sw


As a side note, if I start from a tty, with startplasmacompositor, the session starts without this issue.
Comment 3 Méven Car 2019-10-29 16:23:17 UTC
I have installed libcap-dev and libgbm-dev, recompiled and rebooted and this issue is gone.
Comment 4 Méven Car 2019-10-29 16:24:48 UTC
*** Bug 412532 has been marked as a duplicate of this bug. ***