Re: Fixing framerate

New Message Reply Date view Thread view Subject view Author view

Phil Keslin (philk++at++cthulhu.engr.sgi.com)
Wed, 08 Sep 1999 10:28:30 -0700


The suggestion for the 5000 came from me and wasn't quite correct. The problem has been corrected in IRIX 6.5.5, and for
those of you who don't have the luxury of upgrading, here is an improved version of the sginap replacement code.

- Phil

#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/param.h>

long
sginap(long ticks)
{
#define NSEC_PER_HZ (1000000000/HZ)
    struct timespec ts, ots;
    uint64_t nsec;

    nsec = ticks*NSEC_PER_HZ;
    ts.tv_sec = (nsec > 1000000000ll) ? nsec / 1000000000ll : 0;

    /* remove 10us from the interval for tick margin */
    ts.tv_nsec = nsec - (ts.tv_sec*1000000000ll) - 10000;

    if (nanosleep(&ts, &ots) == -1 && oserror() == EINTR)
        ticks = ots.tv_nsec/NSEC_PER_HZ;
    else
        ticks = 0;
    return ticks;
}

Joaquin Casillas wrote:
>
> Hello all.
>
> I am trying to fix my visual to 30 fps, by setting the phase to
> PFPHASE_LOCK and the framerate to 30 Hz. I'm running Irix 6.5.4, and
> suppose it continues having the sginap problem. I have tried the
> workaround that Ran Yakir suggested, and doesn't work to me. The trick
> Ran suggested was to define the next function in the program:
>
> long sginap (long ticks)
> {
> struct timespec ts;
>
> ts.tv_sec = 0;
> ts.tv_nsec = ticks * 10000;
>
> nanosleep (&ts, 0);
> }
>
> I think someone got the problem solved by using this trick (changing
> 10000 to 5000), but the fps in my program still drops from 30 to 20 fps,
> while when running in free run never drops from 30 fps (but jumps to 60
> in some cases).
>
> I run my program with root privileges (non degrading priorities).
>
> Is there any other workaround for this problem?
> Has it been fixed in the 6.5.5 release?
>
> Thanks in advance for any suggestion.
>
> -----------------------------------------------
> Joaquin Casillas Melendez mailto:jcasilla++at++glup.irobot.uv.es
> LISITT (ARTEC) Phone: +34 6 364 2253
> Dept. Electr. & Informatics Addr: Poligono de la Coma s/n
> University of Valencia Valencia (SPAIN)
> -----------------------------------------------------------------------
> 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 Wed Sep 08 1999 - 10:28:36 PDT

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