Bug 424398

Summary: Low fps in Wayland session with fractional scaling
Product: [Plasma] kwin Reporter: Matej Mrenica <matejm98mthw>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: major CC: germano.massullo, joseph, katyaberezyaka, kde, matejm98mthw, vlad.zahorodnii
Priority: NOR Keywords: efficiency
Version: 5.20.90   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:

Description Matej Mrenica 2020-07-19 08:38:54 UTC
SUMMARY
By just moving my cursor around I can push the fps down as low as 20fps.
I am not doing anything else with my laptop, the CPU is idle. Htop shows higher CPU usage for kwin_wayland process up to 40% (of one core) on a Ryzen 5 3550H.
This issue is only present on Wayland. Gnome Wayland is not affected. If there is any type of log or something like that I can provide it. I use fractional scaling but disabling it doesn't make a difference. I have a 60Hz screen set to 60Hz. The fps is not always low, now while I am writing this report it is at 60 but when I switch apps or move my cursor it goes down and needs a while to recover (raise back to 60).
Comment 1 Matej Mrenica 2020-07-26 07:53:38 UTC
After further testing, it looks like Gnome wayland isn't any faster, meaning this issue is likely not caused by Kwin. I would still like to help finding out why is this happening.
Comment 2 Matej Mrenica 2020-09-17 18:29:55 UTC
Performance is a lot better in Plasma 5.20 Beta, but there are still frame-drops in certain situations.
Comment 3 Matej Mrenica 2020-10-14 11:11:41 UTC
One of the situations where frame rate drops significantly is scrolling in Dolphin. Every time I turn the mouse wheel there is a red spike in the fps meter (30 fps). Also grabbing the the scrollbar and moving it up and down causes a drop depending on the movement speed it can be as low as 30fps while the scrollbar is moving.

This is in Plasma 5.20.0
Comment 4 Germano Massullo 2020-10-28 13:34:36 UTC
Sometimes I notice the mouse pointer going at low FPS, so it's like it is warping.

qdbus org.kde.KWin /KWin supportInformation

==========================

Version
=======
KWin version: 5.20.1
Qt Version: 5.15.1
Qt compile version: 5.15.1
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: yes
HAVE_EGL_STREAMS: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: Fedora Project
Vendor Release: 12009000
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: true
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 0
gridUnit: 12
font: Droid Sans [1ASC],11,-1,5,50,0,0,0,0,0
smallSpacing: 3
largeSpacing: 12

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

Options
=======
focusPolicy: 0
xwaylandCrashPolicy: 
xwaylandMaxCrashCount: 3
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: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
compositingMode: 1
useCompositing: true
hiddenPreviews: 1
glSmoothScale: 2
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: false
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:  yes
Number of Screens: 1

Screen 0:
---------
Name: DP-3
Geometry: 0,0,3072x1728
Scale: 1.25
Refresh Rate: 59.997


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: X.Org
OpenGL renderer string: AMD Radeon (TM) RX 480 Graphics (POLARIS10, DRM 3.38.0, 5.8.16-300.fc33.x86_64, LLVM 11.0.0)
OpenGL version string: 4.6 (Core Profile) Mesa 20.2.1
OpenGL platform interface: EGL
OpenGL shading language version string: 4.60
Driver: RadeonSI
GPU class: Arctic Islands
OpenGL version: 4.6
GLSL version: 4.60
Mesa version: 20.2.1
Linux kernel version: 5.8.16
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:
---------------
kwin4_effect_sessionquit
screenshot
desktopgrid
kwin4_effect_translucency
colorpicker
kwin4_effect_fullscreen
kwin4_effect_frozenapp
presentwindows
kwin4_effect_dialogparent
highlightwindow
blur
contrast
startupfeedback
kscreen

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

Effect Settings:
----------------
kwin4_effect_sessionquit:
pluginId: kwin4_effect_sessionquit
isActiveFullScreenEffect: false

screenshot:

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

kwin4_effect_translucency:
pluginId: kwin4_effect_translucency
isActiveFullScreenEffect: false

colorpicker:

kwin4_effect_fullscreen:
pluginId: kwin4_effect_fullscreen
isActiveFullScreenEffect: false

kwin4_effect_frozenapp:
pluginId: kwin4_effect_frozenapp
isActiveFullScreenEffect: false

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

kwin4_effect_dialogparent:
pluginId: kwin4_effect_dialogparent
isActiveFullScreenEffect: false

highlightwindow:

blur:

contrast:

startupfeedback:
type: 1

kscreen:
Comment 5 Matej Mrenica 2020-10-28 20:23:10 UTC
Can you also confirm low fps with the built-in fps meter in, for example, Dolphin when scrolling in a big folder? I personally, always have an fps drop to/bellow 30fps in that situation. Also yesterday my fps was constantly around ~25 because baloo was doing something in the background. As if the rendering thread was waiting for rest of the system or something like that.
Comment 6 Germano Massullo 2020-10-29 00:35:02 UTC
(In reply to Matej Mrenica from comment #5)
> Can you also confirm low fps with the built-in fps meter in, for example,
> Dolphin when scrolling in a big folder? I personally, always have an fps
> drop to/bellow 30fps in that situation. Also yesterday my fps was constantly
> around ~25 because baloo was doing something in the background. As if the
> rendering thread was waiting for rest of the system or something like that.

I confirm with the FPS meter. I got the problem for example moving the Dolphin window around the screen. I cannot reproduce it everytime, but it is not so hard to trigger it
Comment 7 Vlad Zahorodnii 2020-11-02 08:14:51 UTC
I believe things should be slightly better with 5.20.3. See also https://invent.kde.org/plasma/kwayland-server/-/commit/13d878d22b89ec0c79b434080f76390487b63c2c
Comment 8 Matej Mrenica 2020-12-18 18:32:33 UTC
Disabling fractional scaling actually does fix this issue, even though I said otherwise before. So the issue is somewhere in the scaling.
Comment 9 Matej Mrenica 2020-12-18 18:48:00 UTC
To turn scaling back on one can export GDK_DPI_SCALE for gtk apps. Also for QT apps one could use QT_SCALE_FACTOR, but it breaks Plasma, is that an issue?
Comment 10 David Edmundson 2022-01-11 15:03:30 UTC
Performance is something we are always trying to improve. I don't think we can track that within a bug report unless there is something more specific. Right now 1.25 scaling will make clients scale to 2x internally, which is a lot more pixels. This is something we hope to address later upstream.

>To turn scaling back on one can export GDK_DPI_SCALE for gtk apps. Also for QT apps one could use QT_SCALE_FACTOR, but it breaks Plasma, is that an issue?

It's not the direction we want to take, it has a lot of issues with multiscreen.