pts@mendel.acc.Virginia.EDU (Paul T. Shannon) (12/21/90)
In my continuing quest to do precisely timed animation on the NeXT, for
psychophysical experiments, I'm now trying to find the best way (or indeed,
any way) to observe the vertical retrace pulse sent to the video device.
If I can detect these pulses, then I can refresh the screen during the
retrace, and achieve some simple animation without any image shear.
(For any comp.sys.next readers appalled by this strategy, please write
me email, and I'll explain why I'm doing this: we had a lot of
discussion on the topic about a month ago, and I think I persuaded most
that my reasons were sufficient.)
What follows is an excerpt from nextdev/video.h and a
short function I adapted from William Lewis to get the address of video ram.
With this as background, I then ask for help. All speculation, hints,
rumors, program fragments or advice is welcome.
-------------- from video.h --------------
#define NPPB 4 /* # pixels per byte */
#define VIDEO_W 1120
#define VIDEO_MW 1152
#define VIDEO_H 832
#define VIDEO_MH 910
#define VIDEO_NBPL (VIDEO_MW >> 2)
#define WHITE 0x00000000
#define LT_GRAY 0x55555555
#define DK_GRAY 0xaaaaaaaa
#define BLACK 0xffffffff
#define RETRACE_START 0x00
#define RETRACE_LIMIT 0xea /* limit reg value to int @ retrace */
#define RETRACE_MAX 0xfc
#define MWF_SIZE USRSTACK
#define CONTINUE_ANIM 0x12345678 /* continue animation (if any) */
...
#define DKIOCGADDR _IOWR('v', 0, int) /* get address of video mem */
#define DKIOCSMWF _IOWR('v', 1, struct mwf) /* set mwf bounds */
#define DKIOCBRIGHT _IOWR('v', 2, int) /* get/set brightness */
#define DKIOCDISABLE _IO('v', 3) /* disable translation */
#define DKIOCGNVRAM _IOR('v', 4, struct nvram_info) /* get NVRAM */
#define DKIOCSNVRAM _IOW('v', 4, struct nvram_info) /* set NVRAM */
Here's a simple function that gets the address of video ram:
/*----------------------------------------------------------------------------*/
int *getVideoRamAddress (void)
{
int *returnValue;
int fd;
fd = open ("/dev/vid0", 0);
if (fd < 0)
fatalError ("opening video device, at %d in %s", __LINE__, __FILE__);
ioctl (fd, DKIOCGADDR, &returnValue);
close (fd);
return (returnValue);
} /* vidram addr */
/*----------------------------------------------------------------------------*/
So that's the background. Here's the request: does anyone know where
I can get documentation for nextdev/video.h? Where are all of the
video ioctl calls documented? How can I catch the vertical retrace pulse?
- Paul Shannon
pts@virginia.edu