pfVClock(3pf) OpenGL Performer 3.2.2 libpr Reference Pages pfVClock(3pf)NAME
pfStartVClock, pfStopVClock, pfInitVClock, pfGetVClockOffset,
pfVClockOffset, pfGetVClock, pfVClockSync - Initialize and query vertical
retrace clock
FUNCTION SPECIFICATION
#include <Performer/pr.h>
void pfStartVClock(void);
void pfStopVClock(void);
void pfInitVClock(int ticks);
int pfGetVClockOffset(void);
void pfVClockOffset(int offset);
int pfGetVClock(void);
int pfVClockSync(int rate, int offset);
DESCRIPTION
A pfVClock (Video Clock) is a clock which runs at the video retrace rate.
There is one clock for each hardware graphics pipeline which runs at the
video rate of that pipeline. A pipeline's video rate is defined by its
video format (see setmon). To access the video clock a Graphics Library
window must be opened and made current although the window does not need
to be mapped to the display surface (noport in IRIS GL). The screen of
the current window determines which pipe's video clock is accessed on
multipipe machines.
pfStartVClock starts the video clock by enabling CPU interrupts from the
graphics pipeline while pfStopVClock disables CPU interrupts. At this
time, the video clock can be started/stopped only on VGX and VGXT
graphics hardware. On other hardware such as InfiniteReality and
RealityEngine, CPU interrupts are always enabled.
pfInitVClock sets the initial value of the video clock to ticks. Note
that pfInitVClock does not set the video clock, rather it computes an
offset which is added to the real video clock's value. This offset is
unique to a given address space - forked processes each have their own
offset while sproced processes share the offset. The offset computed by
pfInitVClock is returned by pfGetVClockOffset and may be set directly
with pfVClockOffset, simplifying clock synchronization across processes.
pfGetVClock returns the current video retrace count relative to the
initial value set by pfInitVClock.
pfVClockSync puts the calling process to sleep until count modulo rate is
equal to offset. For instance, if the count is 0, the rate is 10 and
offset is 4, then pfVClockSync will return when the count is 4.
Page 1
pfVClock(3pf) OpenGL Performer 3.2.2 libpr Reference Pages pfVClock(3pf)
Subsequent calls with the same values will return when the count is 14,
24, etc. offset must be a non-negative number less than rate and rate
must be positive.
If the retrace count modulo rate is equal to offset at the time
pfVClockSync is called, the caller will not return immediately but will
go to sleep until rate ticks later.
The following code fragment illustrates a true video clock which will
wake up each vertical retrace period (subject to process priorities):
while (1)
{
/* wait for next vertical retrace */
pfVClockSync(1, 0);
/* perform per-interval actions */
:
}
NOTES
pfVClock functionality is not currently supported under Linux.
A GL window (which may be a noport window) must be open before any
pfVClock routines are called.
The video clock count is *not* the swapbuffers count.
Page 2