Kodi Community Forum

Full Version: Text entry dialog causes high CPU temperatures in Full Screen mode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is very odd and problematic. May be a 15.1 problem. It is very reliably reproducible.

My Kodi 15.1 installation is on Opensuse on a Sandy Bridge i7-2600k using VAAPI for the built-in GPU. Confluence skin. Xfce desktop (stock no effects).

At idle, there is about a 5-6% cpu usage which is fine but as soon as I bring up a text entry dialog on the screen (say Search for a Movie in the local Library), the CPU usage jumps to 25-30% even by just keeping the dialog box up on the screen and doing nothing with it. This by itself is not the problem although I don't see why that should be the case.

The above CPU increase usage happens in full screen as well as Windowed mode. In Windowed mode, I don't notice any other side effects. The CPU core temperatures remain the same and the fan speed does not increase (or a very small increase).

Here is the odd part:

If I am in Full Screen mode when I bring the text entry box up, the temperature starts to shoot up and the fans come on loud. The CPU usage is the same at about 20-30%. Watching "top" I don't notice any other process taking up more CPU time between full screen and windowed mode but the temperature rises only in Full Screen Mode as soon as I bring up the text entry dialog box.

Is this "normal"? I am not sure this happened in 14.x. Seems like a possible explanation is that the rise in temperature is due to heavy on-board GPU usage on the i7 but why should this dialog box sitting idle create such a heavy load on the GPU and only in Full Screen mode?

Have no problem while watching videos where hardware decoding is used.

Could it be some strange interaction with the Window Manager?

Sorry no debug log as it takes a lot of time to redact personal information in the logs (Path names, etc) but I have looked at the highest level debug log and there is nothing that is logged after the dialog is brought up while the CPU usage increases. There is no difference in the logs between the full screen (when the temperature shoots up) and the windowed mode where the CPU usage goes up just as in the former but temperature does not.

Same thing with scrolling text. Lot of heat generation in Full Screen mode requiring loud fan rpm AND the two cases above are cumulative! If I am looking at a list of movies and the current movie has a scrolling text in its description, the CPU usage and temperature goes up and if I bring up the dialog box to change the title of the movie while the text is still scrolling in the back, the CPU usage and temperatures start to go higher than either of them by their own. This does seem like a GPU usage problem. I have had thermal shutdown of the machine by trying to change the title of many movies sequentially after a library scan.

Is there a known bug in Kodi 15.1 that results in this problem?

Thanks for any inputs/pointers/suggestions that might shed some light on this.
a text entry box probably renders the screen dirty all the time, which causes constant re-rendering.
You can enable visualize dirty regions in advancedsettings.xml to test this.
Thanks for the tip.

Turns out it is just the entered text box inside the dialog that is always dirty and continuously rendered presumably due to the blinking cursor!!!!! That is probably the most compute-expensive blinking cursor in the history of software. :-)

Any way to avoid this situation? Does it make sense to file a bug report on this? At least to provide the option to have a non-blinking cursor (along with the option to turn off scrolling text everywhere)?

Things like this are a bit embarrassing for such a fine piece of software.
you can try to set dirty region mode to 1. If it works properly with your driver, the issue should be solved.
Tried it. It just makes things worse. The idle CPU usage (without the text dialog box) doubles and the fan hits max speed and the temperature rises another 5-10 degrees with the text dialog box.

Looking at the visualization of the dirty regions, the text echo box remains being continuously rendered regardless of that mode setting.

Also, notice that moving around the keys in that dialog using arrow keys on a keyboard results in some really weird and unnecessary dirty regions way outside the entire dialog. Ideally, it should only dirty the before and after key buttons, if I understand the dirty region optimization correctly for controls.

I think this dialog box needs a serious looking into as to how it renders as it appears to be seriously broken and inefficient in rendering especially on 1080p screens.

Not sure why this became more of an issue in Kodi 15 in my case. Never noticed the problem in Kodi 14 before.
(2015-09-01, 22:58)Common Man Wrote: [ -> ]Tried it. It just makes things worse. The idle CPU usage (without the text dialog box) doubles and the fan hits max speed and the temperature rises another 5-10 degrees with the text dialog box.

Looking at the visualization of the dirty regions, the text echo box remains being continuously rendered regardless of that mode setting.

Also, notice that moving around the keys in that dialog using arrow keys on a keyboard results in some really weird and unnecessary dirty regions way outside the entire dialog. Ideally, it should only dirty the before and after key buttons, if I understand the dirty region optimization correctly for controls.

I think this dialog box needs a serious looking into as to how it renders as it appears to be seriously broken and inefficient in rendering especially on 1080p screens.

Not sure why this became more of an issue in Kodi 15 in my case. Never noticed the problem in Kodi 14 before.

I think you need to look how OpenGL works ... what swapbuffers is and that dirty Region is all we can do.

Reduce your refreshrate to 24hz, but from the looks you have a serious fan issue. Return the box and never try to play an OpenGL game ... This is what kodi is after all.

From what you describe even glxgears would kill your machine and this is also vblanked.

That said: if vblank is working, see the fps in debug overlay, nothing we can do for you.
I'm not sure if this is related or not but I have noticed that on everything I've ever used kodi on, the cpu usage seems clearly higher when browsing and setting artwork and changing episode titles, or searching through actors, things like that. After like a minute or two, the fan turns on and starts working where as when I'm watching videos, I hardly ever hear the fan turn on.

I ahould clarify, by "everything I've used kodi on" I mean 2 devices lol. A windows 8 laptop and my current chromebox openelec
(2015-09-02, 07:15)fritsch Wrote: [ -> ]I think you need to look how OpenGL works ... what swapbuffers is and that dirty Region is all we can do.

Reduce your refreshrate to 24hz, but from the looks you have a serious fan issue. Return the box and never try to play an OpenGL game ... This is what kodi is after all.

From what you describe even glxgears would kill your machine and this is also vblanked.

That said: if vblank is working, see the fps in debug overlay, nothing we can do for you.

glxgears in full screen window, temperature remains at idle and the CPU fan at minimum speed. Much less than Kodi playing a video let alone the blinking cursor or the scrolling text cpu/gpu high burn. glxgear reports 60fps. The box doesn't seem to feel glxgear running in any noticeable way. So that assertion regarding the box would appear to be incorrect.

What I noticed is that the dirty regions extend beyond the text dialog box into rest of screen if I just move from one key to another on the text dialog box (each of which is a button control). This is unlike controls in other areas, like for example the left slide out panel, where moving down the controls makes just that before and after controls dirty. I would expect the same from the keyboard dialog box as well. And why the blinking cursor that continuously and wastefully renders the text entry area would be necessary. Just pointing out things if it helps the team in investigating a problem in the design or implementation or providing options to manage it.

These observations would seem to suggest a problem with text entry dialog rendering rather than it be an unavoidable side-effect.

But if the Kodi team truly feels this is unavoidable, so be it even if I remain unconvinced in my ignorance. I am not an expert in these technologies.
(2015-09-02, 07:36)ilovethakush Wrote: [ -> ]I'm not sure if this is related or not but I have noticed that on everything I've ever used kodi on, the cpu usage seems clearly higher when browsing and setting artwork and changing episode titles, or searching through actors, things like that. After like a minute or two, the fan turns on and starts working where as when I'm watching videos, I hardly ever hear the fan turn on.

I ahould clarify, by "everything I've used kodi on" I mean 2 devices lol. A windows 8 laptop and my current chromebox openelec

From what little I understand...

Kodi is not doing any rendering when watching videos, just passing the media stream to the onboard decoders via the graphics drivers (if accelerated in hardware) and the hardware taking care of the display refresh for rendering the video. This is fairly efficient on modern CPU/GPU hardware and why even the weakest of the boxes can play full 1080P HD videos without showing strain.

The Kodi rendering happens when you have the Kodi UI components - panels, controls, dialog boxes, overlays, artwork, etc. From what little I understand, this is very CPU/GPU intensive for historical/legacy reasons as Kodi itself keeps refreshing the screen for the UI components. They have done some optimizations to only refresh parts of the screen that changes but that still takes significant CPU/GPU resources. How much of that is avoidable, I would have no idea.
All rendering is done by kodi. Every decoded surface is copied to an OpenGL texture and rendered. Nightmare for the GPU. We are working on a zero copy approach, which is vaapi only, currently.

See the New vaapi ERA thread, please. Don't forget all the ppas that are needed.
Please post a Debug Log never the less. Want to make sure it is not CPU rendered in certain gnome3/unity combinations that blacklist Intel drivers.

Make sure vblank sync is set to let driver decode, then turn on debuglogging and restart kodi.