Bug 184251

Summary: high cpu usage from Kwin and xorg
Product: [Plasma] kwin Reporter: Martin <tinchio.nqn>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: alanjprescott, alessandro.ufms, grosser.meister.morti, host, k.kapuscik, karye2004, kde, nothereforever, rvalkass, s.de.bie, yg
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Martin 2009-02-13 21:43:43 UTC
Version:           4.2 (using KDE 4.2.0)
OS:                Linux
Installed from:    Ubuntu Packages

Im using KDE 4.2 in Kubuntu 8.10 with a Nvidia integrated graphics on an Acer laptop. The problem is that (apprently) after a couple of visual notification Kwin and xorg start using a little more of CPU, about 25% and up maybe, so the system get really slow. With visual notifications i mean for example plasma notificacions (the ones that appear on copy/paste), kopete's, skype's, etc.
There's no strict time to reproduce the bug because it apparently depends on the notifications number.
Temporary solution is to restart X.
Any other information needed please ask. Thanks
Comment 1 Martin Flöser 2009-02-13 21:46:19 UTC
do you have vsync (in advanced tab) enabled? If not could you please try with this setting.
Comment 2 Martin 2009-02-13 21:57:15 UTC
@Martin: yes vsync was already enabled. Should i disable it or leave like that?
Comment 3 Martin Flöser 2009-02-13 22:26:18 UTC
give it a try, but I don't expect it to solve the problem :-)

Could you please post us your kwinrc? So that we can have a look on the enabled effects.
Comment 4 Martin 2009-02-13 22:30:26 UTC
[$Version]
update_info=kwin3_plugin.upd:kde3.2,kwin_focus2.upd:kwin_focus2,kwin_focus1.upd:kwin_focus1,kwin.upd:kde3.0r1,kwin.upd:kde3.2Xinerama,kwin_on_off.upd:kwin_on_off

[Compositing]
Backend=OpenGL
Enabled=false
GLDirect=true
GLMode=TFP
GLTextureFilter=0
GLVSync=true
HiddenPreviews=0
XRenderSmoothScale=false

[Desktops]
Name_1=
Name_2=
Number=2

[Plugins]
kwin4_effect_blurEnabled=true
kwin4_effect_boxswitchEnabled=false
kwin4_effect_coverswitchEnabled=true
kwin4_effect_desktopgridEnabled=true
kwin4_effect_dialogparentEnabled=true
kwin4_effect_diminactiveEnabled=false
kwin4_effect_dimscreenEnabled=false
kwin4_effect_explosionEnabled=false
kwin4_effect_fadeEnabled=true
kwin4_effect_fallapartEnabled=false
kwin4_effect_flipswitchEnabled=true
kwin4_effect_invertEnabled=false
kwin4_effect_loginEnabled=true
kwin4_effect_logoutEnabled=true
kwin4_effect_lookingglassEnabled=false
kwin4_effect_magnifierEnabled=false
kwin4_effect_maketransparentEnabled=true
kwin4_effect_minimizeanimationEnabled=true
kwin4_effect_mousemarkEnabled=false
kwin4_effect_presentwindowsEnabled=true
kwin4_effect_scaleinEnabled=false
kwin4_effect_shadowEnabled=false
kwin4_effect_sharpenEnabled=false
kwin4_effect_showfpsEnabled=false
kwin4_effect_showpaintEnabled=false
kwin4_effect_snowEnabled=false
kwin4_effect_thumbnailasideEnabled=false
kwin4_effect_trackmouseEnabled=true
kwin4_effect_videorecordEnabled=false
kwin4_effect_wobblywindowsEnabled=false
kwin4_effect_zoomEnabled=true

[Style]
BorderSize=1
ButtonsOnLeft=MS
ButtonsOnRight=HIA__X
CustomButtonPositions=false
PluginLib=kwin3_oxygen
ShowToolTips=true

[Windows]
TitlebarDoubleClickCommand=Maximize
Comment 5 Martin Flöser 2009-02-13 23:36:04 UTC
Could you please try if one of the following solves the problem
 * disable blur effect
 * disable fade effect

Btw it does not make sense to enable both cover and flip switch. Only one of both can be used (yeah we need a way to have mutual exclusive effects)
Comment 6 Martin 2009-02-13 23:47:23 UTC
@Martin: i'll try them and post the result then. Yes i forgot both of them activated.
Comment 7 Martin 2009-02-17 20:46:43 UTC
ok, even with both effects on false i got the same issue.
Comment 8 Martin 2009-02-26 19:13:14 UTC
This seems to get worse. I have to restart X too many times a day, xorg gets 25% of CPU and Kwin got up tu 90%. For a little more information, this problem seems to be instantly when i use a Java based app or a windows app via Wine.
Comment 9 Yves Glodt 2009-03-18 12:26:26 UTC
Hi, here my observations about this issue:

I have a very conservative number of plugins enabled, and it works well until I open more than 5 windows.

With 6 windows the present-windows effect starts to crawl, and even switching windows through the task-manager in plasma panel takes almost a second.
Xorg uses a lot of cpu in that case (~40%)

With 4 windows open it's still as fast as with one.

It feels also that as soon as I open a konsole (which is set to 15% transparency), window handling is slowed down noticeably.

Notice that I have an onboard "Intel Corporation 82915G/GV/910GL Integrated Graphics Controller rev 4", this is certainly a weak point. But speed is quite ok since KDE 4.2, as long as I do not open too many windows... :-)
Comment 10 Yves Glodt 2009-03-18 12:29:23 UTC
Here the (hopefully) relevant parts of my kwinrc

[Compositing]
AnimationSpeed=3
Backend=OpenGL
DisableChecks=false
Enabled=true
GLDirect=true
GLMode=TFP
GLTextureFilter=0
GLVSync=true
HiddenPreviews=4
XRenderSmoothScale=false

[Plugins]
kwin4_effect_loginEnabled=true
kwin4_effect_logoutEnabled=true
kwin4_effect_maketransparentEnabled=true
kwin4_effect_presentwindowsEnabled=true
kwin4_effect_shadowEnabled=true
Comment 11 Yves Glodt 2009-03-18 12:39:09 UTC
Another observation:

Opening 10 kwrite windows takes more than 30 seconds. The first ones open quite fast, but it get's progressively slower.

Opening the 11th kwrite window took ~7 seconds until it properly appeared, and was added to the taskmanager-plasmoid.

I use the intel 2.6 driver here on debian squeeze (xorg from experimental)


On another PC, a laptop with weaker cpu, but better graphics card ( ATI RV350 Mobility Radeon 9600 M10) the slowdown with increased number of windows is also visible, but less. Here I use jaunty with the radeon driver.

So certainly there is a slowdown with higher number of windows. Maybe this can somehow be optimized? :)
Comment 12 Ferdinand 2009-04-23 23:23:46 UTC
*** This bug has been confirmed by popular vote. ***
Comment 13 Yves Glodt 2009-04-24 09:43:14 UTC
For information, since my debian unstable has the Intel driver 2.7, with UXA, performance on my "Intel Corporation 82915G/GV/910GL Integrated Graphics Controller (rev 04)" is finally good enough to have compositing enabled without slowing me down. (with moderate effects enabled only of course...)
Comment 14 Mathias Panzenböck 2009-04-29 15:57:18 UTC
I'm experiencing something similar:
kwin uses 4% to 5% of the CPU while "idling". The only thing that happens on the screen is top in a transparent yakuake and gkrellm.
However, sometimes the CPU usage is 12% while idling. Killing kwin and restarting it that way doesn't change anything, only relogin does.

System Spec:
Fedora 10, KDE 4.2.2, Qt 4.5.1
Intel(R) Core(TM)2 Duo CPU E6750 @ 2.66GHz
NVIDIA GeForce 8800 GTS 512
Official NVIDIA drivers version 180.44

kwinrc:
[Compositing]
AnimationSpeed=2
Backend=OpenGL
DisableChecks=false
Enabled=true
GLDirect=true
GLMode=TFP
GLTextureFilter=1
GLVSync=true
HiddenPreviews=5
XRenderSmoothScale=false
Comment 15 Rob V 2009-06-02 22:36:19 UTC
I have been having the same issue, and have found that enabling vsync improves matters, but doesn't solve the issue. CPU usage, rather than staying at a constant 90-100% now fluctuates randomly between about 20% and 80% in spikes. Better, but still odd.
Comment 16 Karim Ryde 2009-09-20 11:34:14 UTC
Same issue here!

Resizing windows like Dolphin or any window for that matter is really sluggish. Top shows that xorg eats cpu and can be 80-100%.

I've got a modern system with Q9550 at 3Ghz 4Gb ram and a nice Nvidia 8600GT card with 512Mb. But still it's feels like syrup!

I've read that the problem is in compositing and drivers. I really hope someone can solve this soon.

Another solution would be if someone can point me to a graphic card that works. I'm ready to buy a new one if necessary.

Thanks!
Comment 17 Thomas Lübking 2009-09-20 15:48:19 UTC
1st off, same as on any other OS: Check your driver.

For decent OpenGL speed you currently need the binary nvidia driver.
Some versions of this driver in the past caused "trouble" on different cards - general strategy: try the latest one, on regressions: revert.

The two things that can have really bad impact esp. on resizing (from my experience)
- not using "direct rendering" (no: you don't load dri, the nvidia driver has this built in) -> this causes high cpu load on X11
- setting the "wrong" "InitialPixmapPlacement" strategy (in my case < 2)
to check:
"nvidia-settings -q InitialPixmapPlacement"
to change:
"nvidia-settings -a InitialPixmapPlacement=2" ("2" can be [0-4])

Changing VSync has no notable impact here.
If you however want to try disabling VSync, please notice that the binary nvidia driver as a global override for this
"nvidia-settings -q SyncToVBlank"
"nvidia-settings -a SyncToVBlank=[0,1]"
you must restart kwin after changing this ("kwin --replace &")
Comment 18 Michael Hampton 2009-12-19 06:06:29 UTC
This seems to be the last open bug for a wide variety of kwin-eats-CPU-on-NVIDIA-cards issues.

I can confirm that this is still an issue on KDE 4.3.3. The problem: When desktop effects is enabled, kwin sometimes uses an unusually high amount of CPU.

In my particular case, it happened when audacious is playing back a file. When stopped, kwin CPU usage goes back to near zero. When desktop effects is disabled, kwin CPU usage stays at near zero. Using the Show Paint effect shows that the audacious window is being repainted pretty much constantly; so I minimized audacious and kwin CPU went back to near zero again.

My setup is: Fedora 12; KDE 4.3.3-3.fc12.x86_64; NVIDIA driver 190.42-1.fc12.4.x86_64

It does not seem to matter whether VSync is enabled or disabled.

I have disabled ALL desktop effects and the trouble persists.

kwinrc looks like this:

[Compositing]
AnimationSpeed=3
Backend=OpenGL
DisableChecks=false
Enabled=true
GLDirect=true
GLMode=TFP
GLTextureFilter=1
GLVSync=false
HiddenPreviews=5
XRenderSmoothScale=false

Interestingly, when running kwin --replace to diagnose this, I always get this message:
*** glibc detected *** kwin: double free or corruption (!prev): 0x0000000001bafed0 *** 

And, this might be related: In the Display control panel, under Size & Orientation, it shows 3 options for refresh rate: Auto, 50 Hz and 51 Hz. KDE seems to have chosen 50 Hz. But my LCD panel is at 60 Hz, as shown in the NVIDIA Settings vendor-supplied control panel. Changing this setting also seemed to have no effect.
Comment 19 Alan Prescott 2010-08-13 17:21:39 UTC
I'm getting something similar - KDE 4.5.0.
In my case its Xorg that eats CPU but not immediately. I thought the offender was kate as I noticed Xorg going ballistic with kate as I tried to work through various progs trying to narrow things down. Even just Alt-Tab to kate was producing 90% CPU for Xorg.
A Logout & login and running kate first shows normal CPU usage for Xorg so it seems to be some sort of cumulative effect - the sort that's really hard to track down ;-)
GFX card is Nvidia GeForce 6800 GS + Driver version x86_256.44
Comment 20 Thomas Lübking 2010-08-13 17:54:35 UTC
Nvidia users that can experience increasing CPU load (even w/o compositing), please have a look at bug #234463 and esp. comments #81 fff.

ie. try to reset the nvidia pixmap cache
nvidia-settings -a PixmapCache=0; nvidia-settings -a PixmapCache=1
Comment 21 Alan Prescott 2010-08-14 09:17:01 UTC
Thanks - will try this next time Xorg overloads the CPU.
Comment 22 host 2010-08-20 19:06:58 UTC
Good day, 

ive got the same issues here on a brand new pc. 
I just turned off Transparency and Blur, now everything is running like a champ again :D
Comment 23 host 2010-08-21 01:03:33 UTC
(In reply to comment #22)
> Good day, 
> 
> ive got the same issues here on a brand new pc. 
> I just turned off Transparency and Blur, now everything is running like a champ
> again :D

//edit:

in addition, i siwtched to "indirect rendering" an tunrned vsynk off. Give it a try
Comment 24 Charlieb000 2011-03-19 04:49:14 UTC
just curious, is there any of you guys that have this bug that can reproduce  Bug 251786?
Comment 25 Martin Flöser 2011-08-14 07:34:07 UTC
merging with newer "KWin is slow" bug

*** This bug has been marked as a duplicate of bug 234463 ***