[comp.sys.sun] detecting the cg6 board

david@eng.sun.com (Xemu Division, Velcro Industries) (05/25/90)

In article <8102@brazos.Rice.edu> pcad!eddy@uunet.uu.net (Eduardo Juncosa)
writes:
>I am trying to detect within a program whether the SPARC station that is
>executing the program had a cg6 graphics accelerator board installed.  SUN
>suggested I do a pr_open("/dev/cgsix0").

The person at Sun who suggested this should be shot (well, at least
corrected) because a) there is no need for a /dev/cgsix0 device (/dev/fb
works just fine) and b) there is such a thing as a multi-headed system you
know!

Probably the best way to do this is to get a file descriptor pointing to
the frame buffer device and then use the FBIOGATTR ioctl.  For example, in
a SunView program you might do something like...

	int fd;
	struct screen screen;
	struct fbgattr fbattr;

	win_screenget((int) window_get(win, WIN_FD), &screen);

	if ((fd = open(screen.scr_fbname, 2, 0)) < 0) {
		/* error */
	}

	if (ioctl(fd, FBIOGATTR, &fbattr) < 0 ||
		fbattr.fbtype.fb_type != FBTYPE_SUNFAST_COLOR) {
		/* it's not a cg6 */
	}
	else {
		/* it is a cg6 */
	}

	(void) close(fd);

David DiGiacomo, Sun Microsystems, Mt. View, CA  david@eng.sun.com

rklatt@uunet.uu.net (Randolf E. Klatt) (05/30/90)

I am running the only SS1+/GX on the local network, which means that the
recently delivered copy of Aviator can only run stand-alone (since Aviator
seems to poll for the GX hardware directly as the code describes).

I also have a 3/260 with what I believe is a cgsix installed, but is now
running as a cgtwo - see startup message.

mcp0 at vme32d32 0x1000000 vec 0x8b 
ie0 at obio 0xc0000 pri 3 
cgtwo0 at vme24d16 0x400000 vec 0xa8 
cgtwo0: Sun-3 color board, double buffered, fast read
root on xd0a fstype 4.2

The GENERIC kernel doesn't help as it only shows how to run a cgsix in a
3/60 (obmem 7). Needless to say aviator doesn't think this is the right
board to talk to.

Can someone tell me how to config it properly as a cgsix, and whether the
code would detect it as being such (under 4.0.3)? And, can a 3/260 run the
aviator demo at a reasonable speed?

Randolf Klatt
Westinghouse Electric
ittc!rklatt@uunet.uu.net
P.S. This is purley a spare-time pursuit, you understand...