Bug 348206 - KWin CPU usage rises when mplayer is playing a video
Summary: KWin CPU usage rises when mplayer is playing a video
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-25 14:36 UTC by Mark
Modified: 2015-05-25 17:37 UTC (History)
0 users

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 Mark 2015-05-25 14:36:33 UTC
Hi,

I was playing a video in mplayer with the system monitor up. The case for that was observing mplayer cpu usage to determine if hardware accelerated decoding was working (it was).

While doing that i noticed kwin going up in CPU usage. Only up to 1 percent so it's still nothing to worry about, but it does "point" to something in the kwin code that is running quite heavily while.. watching a video with mplayer.. I don't see a relation there so kwin might be doing something it doesn't need to do.

So i ran kwin through callgrind (via valgrind) to figure out what's going on here. I didn't have debug symbols for the full frameworks/plasma/qt stack, just for kwin, so my findings might not expose the actual issue, but they will point in the direction of it.

It looks like QObject::property is being called very often when opening an mplayer window. This property is being called (in a cycle) in kwineffects.cpp. The top callers of QObject::property are:
- KWin::EffectWindow::pos
- KWin::EffectWindow::isDesktop
- KWin::EffectWindow::hasAlpha
- KWin::EffectWindow::opacity
- KWin::EffectWindow::isDeleted
- KWin::EffectWindow::contentsRect

What is going on here? Why are these methods (among a lot of others, but they call QObject::property less) being called in a cycle for mplayer, but not for - for instance - dolphin?

One thing that's very important to notice when you decide to debug and fix this. The kwin cpu usage only goes up to 1% (and stays there) when _playing_ a video. Just having the mplayer window with a video in pause will not make kwin hang on 1%.

If you need more info, feel free to ask.

Reproducible: Always
Comment 1 Thomas Lübking 2015-05-25 15:28:31 UTC
because the compositor needs to perform a repaint of the desktop scene ~24 times a second for the refreshing video?
it's oc. restricted to the require portions and layers - but those needs to be figured.

dolphin otoh. doesn't perform constant updates (unless you scroll the view all the time)
Comment 2 Mark 2015-05-25 15:57:25 UTC
(In reply to Thomas Lübking from comment #1)
> because the compositor needs to perform a repaint of the desktop scene ~24
> times a second for the refreshing video?
> it's oc. restricted to the require portions and layers - but those needs to
> be figured.
> 
> dolphin otoh. doesn't perform constant updates (unless you scroll the view
> all the time)

Hmm, that makes sense :)
Thank you for clearing that up.
Comment 3 Thomas Lübking 2015-05-25 17:04:58 UTC
btw, do you have the transparency effect enabled and configured to set inactive windows translucent?
(otherwise i'd expect the ::property calls to be optimized away except in debug builds of Qt)
Comment 4 Mark 2015-05-25 17:37:56 UTC
I have the Translucency effect enabled with the default settings.
Qt is build in release mode (system Qt, Archlinux).
KWin was build with release and debug symbols. So not a full debug build.