Bug 177985

Summary: Kwin very high cpu usage when Minimize or Magic Lamp effects are enabled
Product: [Plasma] kwin Reporter: Luciano Leveroni <kleverness>
Component: compositingAssignee: KWin default assignee <kwin-bugs-null>
Severity: normal CC: adibudeen, damian.only, daniel, f.esser, graham.anderson, ionut.ciocirlan, james.ellis, markusk, martin.schlander, mastergizmo, sasha, wyvern5, yg
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Unspecified   
Latest Commit: Version Fixed In:
Attachments: Xorg configuration

Description Luciano Leveroni 2008-12-17 14:41:36 UTC
Version:            (using Devel)
Installed from:    Compiled sources

I noticed that after some minutes of having Desktop Effects enabled, kwin's cpu usage would suddenly grow up and start using around 80-90% constantly. 

After disabling the effects one by one I discover that turning off Minimize or Magic Lamp effect would immediately drop the cpu usage to normal 0-5%.

I'm using KDE 4.2 beta 2 (4.1.85 from KDEMod Archlinux). This is critical so I hope it gets resolved before the final release :)
Comment 1 Graham Anderson 2008-12-27 14:54:13 UTC
I was able to reproduce today a situation where high CPU utilisation by the X process(almost 100% of one CPU core) appears.

This lasts until X is killed and restarted, and makes some operations in KDE4 extremely unresponsive, and other things almost impossible. For example logging out is almost impossible, and the systray applet is all but dead.

openSUSE 11.1
Version 4.1.85 (KDE 4.1.85 (KDE 4.2 Beta2)) "release 3.1"
Nvidia 180.18 drivers

I can reproduce almost 100% utilisation on one CPU core by the X process by performing the following steps.

1. Have desktop effects + "Minimize" effect enabled
2. Start Kontact/Kmail
3. Hide Kontact to the systray by clicking the close button on the window bar
4. Mouse over the Kmail systray icon

I tried a few variations to see whethere i could reproduce the high CPU usage, and the following does NOT reproduce the high CPU usage.

1. In all test if the "Minimize" effect is  disabled, then I cannot reproduce the high CPU usage

2. No high usage with Kontact Minimized but NOT hidden. By this i mean just minimized to the taskmanager, I can mouse over the systray icon and no high CPU usage will occur. If Kontact is minimized but not hidden, then it does not matter if the "Minimize" effect is enabled or disabled, the problem will not appear.
Comment 2 Martin Flöser 2009-01-02 10:39:03 UTC
*** Bug 178895 has been marked as a duplicate of this bug. ***
Comment 3 sasha 2009-01-03 16:26:42 UTC
KDE 4.2 Beta 2 from ppa repo
Nvidia GeForce 6200
Kubuntu 8.10 / Intrepid Ibex

Kwin would start constantly using 50% - 90% when magic lamp effect was active. It would take some usage before this would happen, but when it did kwin was using the cpu even when no windows were opened any more.  Disabling magic lamp effect made it all good.
Comment 4 Ionut Ciocirlan 2009-01-26 23:04:14 UTC
Definitely reproducible, as per comment #1:
- use compositing, enable minimize effect (regardless of magic lamp);
- close the kmail window.

KWin then starts using ~90% cpu of one core, and is _definitely_ trying to do something with the GPU.

This is deeply annoying as my laptop's nvidia GPU:
- never lowers its clocks (it should do adaptive clocking depending on the task at hand, but stays stuck at the highest performance level);
- fan starts blowing full speed;
- temperature ultimately goes up to 100°C and beyond!
- makes the system consume more than 60W of power continuously, reducing my battery life to a measly 40 minutes.

However I only noticed this yesterday, after upgrading from svn 902586 to 907177.
Comment 5 Ionut Ciocirlan 2009-01-26 23:05:27 UTC
*** This bug has been confirmed by popular vote. ***
Comment 6 Martin Flöser 2009-01-27 00:34:52 UTC
Is anyone experiencing this nasty behaviour with a different application than kontact?

I terribly fail in reproducing this issue. When closing Kontact to systray I do not see any minimizing animation and neither CPU nor GPU load increases. I also have a nvidia card running the 177 driver.

Btw I have always both a kmail and an akregator icon in systray. Perhaps that's the difference? How are your settings?
Comment 7 Luciano Leveroni 2009-01-27 01:27:07 UTC
I've experienced this bug originally many times and I don't use Kontact, but a I haven't found a way to reproduce it yet :s 

If I find a way I'll post it. I'm currently using 4.2.0.
Comment 8 Ionut Ciocirlan 2009-01-27 01:30:42 UTC
I have a Geforce Go 7900GS, with the 180.22 driver; X.org 7.3 and using binaries from the unsupported kde42.debian.net repo.

OpenGL using texture from pixmap, trilinear filter, direct rendering enabled, vsync disabled.

One thing to note is that with direct rendering disabled, it's kwin+Xorg taking up the 90% cpu, about 30% kwin and 60% Xorg. With it enabled, it's kwin alone.

Can't reproduce it with any other trayable application. I couldn't figure out what was causing it until I found this bug report and the duplicate #178895 -- with kmail I can reproduce it 100% of the time.

If I'm running kmail & akregator separately, I get this only for kmail. If I'm running kontact, I get it even if the kontact window has akregator selected.

There's just one combination producing it: kmail + minimize animation (with all other effects off, shadows off etc.)
Comment 9 Ionut Ciocirlan 2009-01-27 01:40:17 UTC
Immediate update: I discovered this happens only if the Fade effect is disabled.

Minimize Animation / Magic Lamp on their own trigger the bug. Enable fade and it's gone.
Comment 10 adibudeen 2009-01-27 01:44:37 UTC
I was wondering why the problem had stopped on my computer, but now that I think about it, I did enable the fade effect.  I can confirm that this seems to be a workaround.
Comment 11 Florian Eßer 2009-01-30 09:01:46 UTC
This does not solve the problem for me.
I have activated Fade effect since long ago, but still kwin and X sometimes start to consume almost 100% CPU load.

I am using an ATI HD4850 with fglrx driver.
Comment 12 Damian 2009-02-02 20:26:03 UTC
Created attachment 30879 [details]
Xorg configuration
Comment 13 Damian 2009-02-02 21:01:49 UTC
I misused the attachment mechanism. Please delete my file.

I'm very sorry for the inconvenience.
Comment 14 Damian 2009-02-02 21:08:54 UTC
Disabling the minimize effect didn't solved the problem for me. kwin still raises the cpu usage to 17% after a while. I also use kontact but I'm not sure it is the problem.

I have an nvidia Quadro FX 570M graphics card running the 180.27 drivers in a 2.6.27 kernel (gentoo release).

Please let me know if you need more information.

Best regards,
Comment 15 Graham Anderson 2009-09-02 21:27:31 UTC
I'm pretty sure this issue was fixed some time ago, I have not seen the problem for a while and it's certainly not existant for me in 4.3.x
Comment 16 Martin Flöser 2009-09-02 21:37:17 UTC
thanks for the info. If anyone still notices that problem please reopen
Comment 17 wyvern 2009-10-18 04:00:09 UTC
I'm still seeing consistent approx. 20% kwin cpu usage on two boxes. One is a Core 2 Duo 2.4Ghz with a 8800GTX, the other is a Core 2 Quad 2.4GHz with a 8600GTS.
Comment 18 wyvern 2009-10-18 04:01:08 UTC
I should add this is with kde 4.3.2 on both boxes.
Comment 19 Michael Stenzel 2009-10-28 22:41:09 UTC

I see this behavior (or very similar) on KDE 4.3.2 with a PyGTK
Application called "fpdb" (free poker database).

In the newest version they added a minimize to tray icon function.
(I have git version from: http://trac-git.assembla.com/fpdboz/browser)

With desktop-effects AND minimize effect enabled, the fpdb window
can minimize to tray, but if you click the trayicon to bring the 
main window back, kwin starts to eat all cpu and the main fpdb window
never comes back up.

If I disable the minimize effects, the window is still missing after
minimize to tray, but it doesn't eat up all cpu.

With desktop-effects disabled all works ok, the window comes back up fine
after minimize to tray... Its very weird.
Comment 20 jamese 2009-10-29 07:48:47 UTC

I've had high CPU usage for quite a while now and stumbled across this bug trying to find a solution. I was able to reduce CPU usage of X and Kwin remarkably (about 50%) just by unchecking Magic Lamp. I'm unsure why this in itself would suck CPU up as it should only be active when minimising/maximising?
Anyway, my CPU temp dropped by 10-15 degrees as well so at least my knees won't get burnt now.

Kubuntu Karmic RC2, KDE 4.3.2 installed from packages
Dell XPS M1330
Nvidia 185.18.36-0ubuntu9 driver
GeForce 8400M GS card
Intel Core2 Duo @ 2.5Ghz

The following desktop effects are enabled and CPU usage seems normal (hint: you can watch the CPU usage with the system monitor widget)
Desktop Grid, Present Windows, Dim Screen for Admin, Dial. Parent, Shadow, Logout and Login

Hope this helps someone else googling around for info.
Comment 21 Thomas Lübking 2009-11-25 17:29:21 UTC
SVN commit 1054144 by luebking:

move animation handling to prePaintScreen, avoid multiple hash lookups

BUG: 177985
BUG: 184859
catch windows closing during the animation

 M  +42 -29    minimizeanimation.cpp  
 M  +1 -0      minimizeanimation.h  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1054144
Comment 22 Thomas Lübking 2009-11-25 17:36:46 UTC
SVN commit 1054146 by luebking:

BUG: 177985
BUG: 184859

catch windows closing during the animation

 M  +5 -0      magiclamp.cpp  
 M  +1 -0      magiclamp.h  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1054146
Comment 23 Markus Kohls 2010-01-20 05:24:29 UTC
Can this be backported to 4.3.5?