Posts: 13
Joined: Apr 2004
Reputation:
0
ovyg
Junior Member
Posts: 13
Hi guys,
If you still have the 100% CPU issue (like, you are unfortunate enough to have an ATI card on Linux without the opengl VBLANK support), you can try making the following change:
in xbmc/Application.cpp:
* change the constant singleFrameTime to, say, 33 (1000/fps)
* smile at the comment line right above
The GUI transitions will be just a little bit jerkier, but the idle CPU goes down to about 5% on my machine.
If I have time, I will send a proper patch -- I think xbmc should lower (or even stop) its rendering frequency on idle. CPU cycles should be treated with respect for an always-on program. Until then, this makes XBMC behave nicely for me.
Posts: 80
Joined: Apr 2007
Reputation:
0
sudo apt-get remove xserver-xgl
Im on Hardy Heron Kubuntu and had the 100% issue removing the above cured it but now it wont run full screen - im farily sure this is video card related but u might want to try it to prove a point
Shane
Posts: 35
Joined: May 2008
Reputation:
0
Gaarv
Junior Member
Posts: 35
I installed from alternate CD then installed chosen packages by apt. Wasnt on the dpkg list but tried anyway.
No luck, I do not have this package installed.
XBMC Linux Ubuntu 8.04 - Antec Fusion Black
Gigabyte MA78GM-S2H - AMD Athlon 64 X2 BE-2350
Corsair 2Go DDRII PC6400 - Samsung Spinpoint 500 Go
Sony Bravia KDL-40W4000 - Logitech Harmony 555
Posts: 13
Joined: Apr 2004
Reputation:
0
ovyg
Junior Member
Posts: 13
I'm sorry to hear that Gaarv.
Can you add the following change to Application.cpp to figure out what's going on? (This log line helped me debug my idle CPU issue)
* ~line 2275, somewhere within if (g_videoConfig.GetVSyncMode() != VSYNC_ALWAYS)
if (lastFrameTime % 1279 < singleFrameTime) CLog::Log(LOGNOTICE, "lastFrameTime: %u singleFrameTime: %u currentTime: %u",lastFrameTime, singleFrameTime, currentTime);
This will log the frame rendering times in XBMC_HOME/xbmc.log roughly once a second.
The goal is to have sleep(nDelayTime) active most of the time on idle. That means that you should change singleFrameTime to at least twice the typical currentFrameTime - lastFrameTime.
Posts: 13
Joined: Apr 2004
Reputation:
0
ovyg
Junior Member
Posts: 13
While you're still having problems, it wouldn't hurt. In my experience, the CPU usage does not increase much with DEBUG. Anyway, this logline is NOTICE so it will get written regardless.
Posts: 35
Joined: May 2008
Reputation:
0
Gaarv
Junior Member
Posts: 35
From the log I pasted I have : currentFrameTime - lastFrameTime = 50
So should I change singleFrameTime to at least 100 ?
XBMC Linux Ubuntu 8.04 - Antec Fusion Black
Gigabyte MA78GM-S2H - AMD Athlon 64 X2 BE-2350
Corsair 2Go DDRII PC6400 - Samsung Spinpoint 500 Go
Sony Bravia KDL-40W4000 - Logitech Harmony 555
Posts: 13
Joined: Apr 2004
Reputation:
0
ovyg
Junior Member
Posts: 13
I've tracked down the root problem -- it seems that the ATI driver uses a busy loop to wait for vsync (driver settings, not xbmc). So it sits there consuming CPU, for example running
__GL_SYNC_TO_VBLANK=1 glxgears
results in the expected 60 fps, but with 100% CPU usage (it should be negligible if the driver did the right thing).
I'll open a bug against the ATI driver in their bug db. And if I have time this weekend I'll post a proper optional workaround that can make it to the xbmc code.
Posts: 35
Joined: May 2008
Reputation:
0
Gaarv
Junior Member
Posts: 35
Nice find, great job ovyg
XBMC Linux Ubuntu 8.04 - Antec Fusion Black
Gigabyte MA78GM-S2H - AMD Athlon 64 X2 BE-2350
Corsair 2Go DDRII PC6400 - Samsung Spinpoint 500 Go
Sony Bravia KDL-40W4000 - Logitech Harmony 555