Don't render GUI if screensaver is active
#1
Hi all

Been looking into anything which will reduce CPU usage on a Raspberry Pi and it occurred to me that it would be good to simply not render the GUI if the "Black" screensaver is active. This will allow the Pi to do "other stuff" in the background, plus I'm running Freeswitch : what I'd ultimately like to do is send a command via JSON from Freeswitch to XBMC when a call is answered to immediately turn on the screensaver. At that point XBMC should be taking up 0% CPU and Freeswitch can have all the resources it needs.

Big fat caveat : I'm not a programmer. I know a bit of c# and that's about my lot. So what I tried was in application.cpp...

// do not render if we are stopped
if (m_bStop)
return;

// do not render if screensaver is active and screensaver is black
// turn on for Raspberry Pi and similar
if (m_bScreenSave && m_screenSaver && m_screenSaver->ID() = "screensaver.xbmc.builtin.black")
return;

Obviously I'm guessing at the syntax, and obviously it's wrong. Can someone point me in the right direction, please ?

Thanks

Pete
Reply
#2
Dirty rendering should already do what you want. (see the wiki)
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#3
Thanks for the response. Dirty rendering does definitely go part of the way but I want to be able to accomplish something a little more. Something along the lines of "If Black screensaver is active don't even bother looking for dirty regions, just skip the entire render cycle altogether".

Ultimately I'd like to be able to create a sort of semi-sleep mode where, by not performing functions if the black screensaver is active, the CPU will be greatly reduced. For example, the main loop could be set to skip almost everything except for looking for things which would "wake it up"... CEC messages, JSON, keyboard events and similar.

I haven't put alot of thought into it as yet... barely any actually so I don't know what the ramifications are of doing that are, but it does seem like a fairly good way to start learning a bit of C++ and the internals of XBMC.
Reply
#4
i always used the screensaver "black" to reduce cpu usage on idle. since eden it doesnt work anymore. although the screen turns black, the cpu usage stays on 20-30%. and it makes no difference wether i enabled or disabled dirty regions.
i even suspect the implementation of dirty region as reason for this behaviour, although i am not a coder and cant narrow it down.
maybe someone can help out finding the reason for this?!
Reply
#5
Sorry to revive this post, and i know this has been addressed a lot of times, but i think last poster is right, i am using a g1610 ivy bridge cpu with ubuntu minimal and xbmc 12.2 and when in the GUI, cpu runs at around 48-50C. when decoding h264 1080 video it goes down to 36-38

it does not change a thing if i use dirty regions or not, temps stay the same, with black screen saver enabled and screen saver active, temps still run at around 50C, it does go down a couple degrees if i change screen refresh to 30fps but gui gets sluggish.. still it does not go below 46C...

is it possible dirty regions are not working at all ? or would it be too complicated (code-wise) to fully disable gui rendering during screen saver ?

for what i have been reading, a lot of us use a machine like this with xbmc in the screen , while using it as a nas/torrentbox/ftp/http server, 24/7 and having the this option would be awesome to keep cpu temps and power usage down

thanks a lot!

Juanjo
Philips 32PFL6606D
Intel N3150 fanless + 4Gb DDR3 + SSD 64Gb + 3TB+3TB WD RED
Hama MCE remote.
Ubuntu 18.04 minimal install + KODI
Reply
#6
you might be using a skin that effectively disables DR, by constantly doing something. Try with confluence and make sure v-sync is enabled.
Reply
#7
RSS feed ticker looks to use the most CPU / GPU when XBMC is idle, not only on Raspberry Pi but all platforms, so maybe begin to look at the GUI code for that?

Same issue seems to be going on with scrolling text on the screen with long file names, and enabling dirty regions does not seem to help for those issues at all.

Other than that I have noticed that some service plugins / addons or background python scripts can also cause high CPU usage in XBMC.
Reply
#8
code patches welcome
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#9
Scrolling text is definitely an area that will be investigated. I have no idea on an ETA, but I can tell you that several developers are aware of the issue and expressed an interest in improving that.
Reply
#10
thanks a lot to everyone, Wsnipex, i have just installed xbmc from your repo for vaapi deinterlacing, confluence is installed, vsync is set to let driver decide (will that be enough?), screensaver set to black screen, rss feed disabled, screen refresh to 30fps temps went down to around 38C, which is really good i think. while playing high bitrate content temps drop to 33-34, though that difference with previous measurements, might be ambient temp diffs, tomorrow i will test raising screen fps and see what happens with temps, but i think that is the switch that is helping the most...

thanks again for your time
Juanjo
Philips 32PFL6606D
Intel N3150 fanless + 4Gb DDR3 + SSD 64Gb + 3TB+3TB WD RED
Hama MCE remote.
Ubuntu 18.04 minimal install + KODI
Reply
#11
that sounds about correct, but temps ofc depend heavily on your hardware and ambient temp.
As was already said above, use a idle home screen to test this.
Reply

Logout Mark Read Team Forum Stats Members Help
Don't render GUI if screensaver is active0