Ran Yakir (rany++at++netvision.net.il)
Fri, 26 Mar 1999 13:27:21 +0200
I stumbled across a bug in IRIX 6.5 last week. I think that you
experience the same bug. Are you running IRIX 6.5 ?
Assuming you do, the bug is in sginap() call. sginap(1) should sleep for
10 milisec. On 6.5, it will sleep for 20 !
Performer uses sginap(1) if you are running on a rate lower than the
display rate (i.e. running at 30 Hz). After your channel draw function
is done, it will take the time, and use a couple of sginap(1)s to sleep
until almost the end of the frame. Then it will call glXSwapBuffers or
call your swapbuffers callback. The funny thing is - if your scene is
heavy (i.e. can not run at 60Hz because you draw lots of polygons), you
will be OK, because Performer will not issue a sginap call. If you scene
is empty, like when you draw one large polygon, it will call sginap(1)
twice, thinking it sleeps 20 milisec, when in fact it sleeps for 40
milisec.
The solution is to run with root priviledges, and with realtime priority
(set with schedctl() or npri). It seems that sginap behaves better in
that case. However, my tests in that direction were inconclusive, and I
finnaly decided that it's better to use nanosleep() instead. nanosleep()
sleeps at finer resolution than sginap(), but it also requires realtime
priority on IRIX 6.5.
What you should do is define a function in your code :
long sginap (long ticks)
{
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = ticks * 10000;
nanosleep (&ts, 0);
}
This will override the sginap in libc, and call nanosleep instead. I may
be wrong about the syntax of nanosleep. You'de better see the man pages.
Hope it helps
Ran
--
__ | Ran Yakir
/_) _ __ \ / _ / o __ | 28 Ben Gurion St.
/ )_ (_(_) ) \/ (_(_/<_(_)( | Hod Hasharon 54200
_/ | Israel
-------------------------------------+--------------------------------
At Home : | At Work :
| RT-SET
Voice : +972-9-7489974 | Voice : +972-9-9552236
Fax : +972-9-7422149 | Fax : +972-9-9552239
E-mail : rany++at++netvision.net.il | E-mail : rany++at++rtset.co.il
http://rtset.co.il/rany
This archive was generated by hypermail 2.0b2 on Fri Mar 26 1999 - 03:29:29 PST