[WobblyWindows] Prevent hash table to grow significantly
AbandonedPublic

Authored by anthonyfieroni on Sep 21 2018, 7:41 AM.

Details

Reviewers
zzag
Group Reviewers
KWin
Summary

I'm not pretty sure that this is actual problem, but after several days of usage wobbly animation became *chopped*, restarting effect fix issue, so i think contains on huge hash table is a problem (it's in prePaintWindow and paintWindow

Diff Detail

Repository
R108 KWin
Lint
Lint Skipped
Unit
Unit Tests Skipped
anthonyfieroni created this revision.Sep 21 2018, 7:41 AM
Restricted Application added a project: KWin. · View Herald TranscriptSep 21 2018, 7:41 AM
Restricted Application added a subscriber: kwin. · View Herald Transcript
anthonyfieroni requested review of this revision.Sep 21 2018, 7:41 AM

freeWobblyInfo is called from slotWindowClosed, so in theory it shouldn't grow indefinitely?
There's a conditional on m_closeEffectEnabled so maybe in some circumstance it is indeed missed. I don't know the architecture enough to judge whether doing unconditionally doing it in windowDeleted is a proper fix

Your are right, i don't have noticed it. So what i see when moving windows around (after several days usage) result in high cpu usage, looks like it preforms searching or other heavy operation.

@broulik , @zzag did you have some ideas?

zzag added a comment.Sep 21 2018, 10:55 AM

When you start to experience lags in the Wobbly Windows effects, can you please run

qdbus org.kde.KWin /KWin supportInformation

and post the output here.


Regarding the subject line, KWin follows different style for that. It should be "[effects/wobblywindows] Blah-blah", please stick with that.

Regarding the commit message, it would be great to have a thorough analysis, e.g. does the amount of used memory grow over time, is the wobbly windows effect active all the time (i.e. it doesn't clean up after itself), describe how you use the effect, what does the qCDebug in the destructor says, profile KWin (e.g. with hotspot), etc.

There's a conditional on m_closeEffectEnabled so maybe in some circumstance it is indeed missed. I don't know the architecture enough to judge whether doing unconditionally doing it in windowDeleted is a proper fix

It's false by default. So, I think that shouldn't be a problem. (also, maybe it would be better to drop OpenEffect and CloseEffect, but that's off topic)

anthonyfieroni added a comment.EditedSep 21 2018, 1:01 PM
In D15634#329417, @zzag wrote:

When you start to experience lags in the Wobbly Windows effects, can you please run

qdbus org.kde.KWin /KWin supportInformation

I don't think that we can see something notable here.

Regarding the commit message, it would be great to have a thorough analysis, e.g. does the amount of used memory grow over time, is the wobbly windows effect active all the time (i.e. it doesn't clean up after itself), describe how you use the effect, what does the qCDebug in the destructor says, profile KWin (e.g. with hotspot), etc.

It does not have a higher memory consumption, just wobbling is performed slow and takes higher cpu usage, it's increased by spending time, animation goes *cropped-er* also.

KWin Support Information:
The following information should be used when requesting support on e.g. http://forum.kde.org.
It provides information about the currently running instance, which options are used,
what OpenGL driver and which effects are running.
Please post the information provided underneath this introductory text to a paste bin service
like http://paste.kde.org instead of pasting into support threads.

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

Version
=======
KWin version: 5.13.4
Qt Version: 5.11.1
Qt compile version: 5.11.1
XCB compile version: 1.13

Operation Mode: X11 only

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: 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: 12001000
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: true
alphaChannelSupported: true
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 3
gridUnit: 10
font: Liberation Sans,11,-1,5,50,1,0,0,0,0,Italic
smallSpacing: 2
largeSpacing: 10

Platform
==========
Name: KWin::X11StandalonePlatform

Options
=======
focusPolicy: 1
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 750
delayFocusInterval: 600
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 0
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: false
compositingMode: 1
useCompositing: true
compositingInitialized: true
hiddenPreviews: 1
glSmoothScale: 1
xrenderSmoothScale: true
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:  no
Number of Screens: 1

Screen 0:
---------
Name: eDP-1
Geometry: 0,0,1920x1080
Scale: 1
Refresh Rate: 60.0204


Compositing
===========
Compositing is active
Compositing Type: OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2) 
OpenGL version string: 4.5 (Core Profile) Mesa 18.1.7
OpenGL platform interface: EGL
OpenGL shading language version string: 4.50
Driver: Intel
GPU class: Unknown
OpenGL version: 4.5
GLSL version: 4.50
Mesa version: 18.1.7
X server version: 1.20.1
Linux kernel version: 4.17.17
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_logout
kwin4_effect_frozenapp
kwin4_effect_windowaperture
kwin4_effect_translucency
kwin4_effect_scalein
kwin4_effect_morphingpopups
kwin4_effect_maximize
kwin4_effect_login
kwin4_effect_fade
kwin4_effect_dialogparent
slidingpopups
wobblywindows
slide
screenshot
minimizeanimation
flipswitch
diminactive
desktopgrid
coverswitch
colorpicker
presentwindows
highlightwindow
blur
contrast
startupfeedback
screenedge
kscreen

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

Effect Settings:
----------------
kwin4_effect_logout:

kwin4_effect_frozenapp:

kwin4_effect_windowaperture:

kwin4_effect_translucency:

kwin4_effect_scalein:

kwin4_effect_morphingpopups:

kwin4_effect_maximize:

kwin4_effect_login:

kwin4_effect_fade:

kwin4_effect_dialogparent:

slidingpopups:
fadeInTime: 150
fadeOutTime: 250

wobblywindows:
stiffness: 0.06
drag: 0.9
moveFactor: 0.1
xTesselation: 20
yTesselation: 20
minVelocity: 0
maxVelocity: 1000
stopVelocity: 0.5
minAcceleration: 0
maxAcceleration: 1000
stopAcceleration: 0.5
moveEffectEnabled: true
openEffectEnabled: false
closeEffectEnabled: false
moveWobble: true
resizeWobble: true

slide:

screenshot:

minimizeanimation:

flipswitch:
tabBox: false
tabBoxAlternative: false
duration: 200
angle: 30
xPosition: 0.33000001311302185
yPosition: 1
windowTitle: true

diminactive:
dimPanels: false
dimDesktop: false
dimKeepAbove: false
dimByGroup: true
dimStrength: 10

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

coverswitch:
animationDuration: 200
animateSwitch: true
animateStart: true
animateStop: true
reflection: true
windowTitle: true
zPosition: 900
primaryTabBox: false
secondaryTabBox: false

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:

contrast:

startupfeedback:
type: 1

screenedge:

kscreen:
zzag requested changes to this revision.Sep 21 2018, 3:43 PM

This patch doesn't improve anything.

When window stops wobblying, resources are cleaned up https://phabricator.kde.org/source/kwin/browse/master/effects/wobblywindows/wobblywindows.cpp$1051-1060

As I said earlier, please do proper analysis. Currently, this patch looks like a shot in the dark.


Also, FWIW, I also use the Wobbly Windows effect(well, with my settings it's rather Jelly Windows) and don't experience such problems (I usually reboot my laptop only after kernel updates).

This revision now requires changes to proceed.Sep 21 2018, 3:43 PM
In D15634#329858, @zzag wrote:

As I said earlier, please do proper analysis.

How?

Also, FWIW, I also use the Wobbly Windows effect(well, with my settings it's rather Jelly Windows) and don't experience such problems (I usually reboot my laptop only after kernel updates).

Me too

toni@toni-pc ~]$ inxi -I
Info:
Processes: 264 Uptime: 25d 10h 21m Memory: 7.69 GiB used: 3.07 GiB (40.0%)
Shell: bash inxi: 3.0.24
zzag added a comment.Sep 22 2018, 10:08 AM

How?

Well, for the beginning, CPU profiling, I guess.

In D15634#330047, @zzag wrote:

Well, for the beginning, CPU profiling, I guess.

I don't see how it'll help, since it works as expected several days. We talk to possible driver bug (it looks not related since other effects are performed well) or small, as size, objects leak but numerous which can downside container lookup.

zzag added a comment.Sep 22 2018, 5:37 PM

I don't see how it'll help, since it works as expected several days. We talk to possible driver bug (it looks not related since other effects are performed well) or small, as size, objects leak but numerous which can downside container lookup.

If that's indeed a leak, then the Wobbly Windows effect will be among active effects (in the support information).
I doubt it has something to do with "container lookup." (or with this effect at all)

I suggest you to file a bug report instead (kwin > effects-various).

I run it with debug messages for a while, there is no leak in windows neither in stackingOrder. @zzag if you have suggest to watch some variable or container change? I can transform this review to some profiling changes, removing double lookups, const ref against copying of Pair and so on.

zzag added a comment.Sep 23 2018, 7:06 PM

if you have suggest to watch some variable or container change?

Frankly, I have no idea. Maybe, that's an issue in libkwineffects, or in graphics driver, or somewhere else in KWin. Who knows... I doubt that's because there is something wrong in the effect.
FWIW, on Wayland, I experience lags in the Sliding Popups effect if some Qt application is running (e.g. Dolphin). (I didn't spend much time trying to figure out why that is happening)

I can transform this review to some profiling changes, removing double lookups, const ref against copying of Pair and so on.

Yep, that would be great, but please create another revision for that. :-)

anthonyfieroni abandoned this revision.Oct 12 2018, 7:35 AM