Re: the elusive constant frame rate

New Message Reply Date view Thread view Subject view Author view

Phil Keslin (philk++at++cthulhu.engr.sgi.com)
Thu, 01 Jul 1999 22:24:51 -0700


This is a known bug in IRIX6.5 that will be fixed in the next
maintenance/feature released (6.5.5). The sginap call that is used to
pause the Performer DRAW process waits too long with 6.5 (a behaviour
change). DRAW will make this call when it's target frame rate is less
than the video rate. The new behaviour holds off the process up to
another clock tick causing the DRAW to swap late.

Here is a simple change that you can affect to correct the problem. Your
process must run at a non-degrading priority (real-time) for this to
work. Build the following code into a DSO (seek the make line below) and
follow the instructions for running your application.

#include <time.h>
#include <errno.h>
#include <sys/param.h>
long
sginap(long ticks)
{
#define NSEC_PER_HZ (1000000000/HZ)
    struct timespec ts, ots;
    ts.tv_sec = 0;
    ts.tv_nsec = ticks*(NSEC_PER_HZ-100); /* just short of a tick */
    if (nanosleep(&ts, &ots) == -1 && errno == EINTR)
        ticks = ots.tv_nsec/NSEC_PER_HZ;
    else
        ticks = 0;
    return ticks;
}

cc -o sginap.so -shared sginap.c

When you run your application do the following.

env _RLD_LIST="./sginap.so:DEFAULT" <cmd> <args>

This should replace the sginap call in your executable. Assuming that
you are running with at a realtime priority, this should alleviate your
problem. With 6.5.5, you can eliminate the above WAR.

- Phil

Juan Saenz-Diez wrote:
>
> Hi Geoff,
>
> For an almost unspoiled frame rate evaluation, I would suggest that you turn
> off stats and type in some terminal window something like:
>
> sar -g 1 1000
>
> and watch the last column for actual swapbuffer rate.
>
> Regards,
> Yuri.
>
> >From: Geoff Levner <g.levner++at++acsys.it>
> >To: info-performer++at++sgi.com
> >Subject: the elusive constant frame rate
> >Date: Thu, 01 Jul 1999 13:24:40 +0200
> >
> >I have a MultiGen scene which runs in perfly at 30-60 Hz in
> >PFPHASE_FREE_RUN, and I would like for it to run at a constant 30 Hz.
> >Sounds easy. But if I set the phase to PFPHASE_LOCK (or FLOAT, or
> >LIMIT) and set the target frame rate to 30, the actual frame rate varies
> >between 20 and 30 Hz, or sometimes even 15. And if I set the target
> >frame rate to 15, the actual frame rate can go as low as 7.5!
> >
> >Can anyone tell me what is happening here?
> >
> >On further investigation, I noticed that the actual frame rate is
> >slowest when the viewing frustum is the most uncluttered. That is, with
> >a target of 15 Hz, I get 15 Hz somewhere in the middle of the scene, but
> >7.5 Hz when looking up toward the sky (which is the default pfEarthSky,
> >no textures). In fact, anything I do to increase drawing time (such as
> >turning off culling) actually increases the frame rate (sic!). If you
> >look at the stats when the frame rate is lagging, everyone is waiting on
> >the draw process, which consists of a tiny solid line followed by a
> >looooong dotted line.
> >
> >Even without my scene, I found a similar phenomenon in perfly. If I run
> >perfly with an empty scene and lock the frame rate to 15 Hz --
> >
> > perfly -P 1 -r 15 -E skyclear
> >
> >-- and then turn on the statistics, the actual frame rate is 7.5....
> >
> >All tests were done on an Onyx2 IR2 with 4 CPUs running IRIX64 6.5 and
> >Performer v2.2.2.
> >
> >HELP!
> >
> >--
> >Geoff Levner -- g.levner++at++acsys.it
> >ACS Studio, via Aurelia 58, 00165 Roma, Italy
> >tel. +39-063936331, fax +39-0639363317
> >-----------------------------------------------------------------------
> >List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> > Submissions: info-performer++at++sgi.com
> > Admin. requests: info-performer-request++at++sgi.com
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

-- 
Phil Keslin <philk++at++engr.sgi.com>

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Thu Jul 01 1999 - 22:25:43 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.