Slick Forums

Discuss the Slick 2D Library
It is currently Thu May 23, 2013 3:58 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Apr 29, 2012 10:59 pm 
Offline

Joined: Sun Mar 04, 2012 7:35 am
Posts: 14
I created a blank BasicGame with nothing in the update or render methods and set vsync to true. The CPU usage is very high (over 50% of my dual core). The fps is steady at 60 and I have a black window displayed. Shouldn't the vsync cause Slick to sleep or is it just doing a busy loop in the background?


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 1:41 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1469
Also try using GameContainer.setTargetFrameRate, as that will cause the actual sleeping via Display.sync.


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 5:20 am 
Offline

Joined: Sun Mar 04, 2012 7:35 am
Posts: 14
Ok, with VSync and setTargetFrameRate(60) both set it was still gobbling up my cpu. I tried with just setTargetFrameRate(60) and it was down to 1 or 2% which is great.

More testing on my real game trying with just setTargetFrameRate(60) and I get screen tearing. VSync obviously solves it but why does it cause so much cpu usage compared to setTargetFrameRate(60)? Looking for advice on how can I eliminate screen tear without spiking my cpu.


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 5:58 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1172
High CPU usage with vsync is an indication for a bad/not correctly working GL driver which does busy looping instead of using interrupts.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 6:54 am 
Offline

Joined: Sun Mar 04, 2012 7:35 am
Posts: 14
Hmm. I'm running Windows XP 32 bit, Geforce 8800 GT with the latest driver. So it's a problem with this video driver?


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 7:39 pm 
Offline

Joined: Sun Mar 04, 2012 7:35 am
Posts: 14
If anybody else runs into this with their nvidia cards I found a solution after a bit of googling. In a nutshell, from the NVidia Control Panel go to Manage 3D Settings/Global Settings and set the "Threaded Optimization" property to false. Once I did this, my cpu went from spiked to 1 or 2% usage. Needless to say, I'm not impressed with "Threaded Optimization".

http://www.retrocopy.com/blog/29/nvidia ... moron.aspx


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group