plan 9 kernel history: overview | file list | diff list

1998/0116/pc/vgas3.c (diff list | history)

1997/1101/sys/src/9/pc/vgas3.c:44,521998/0116/sys/src/9/pc/vgas3.c:44,63 (short | long | prev | next)
1994/0803    
static void 
1997/1101    
s3page(VGAscr* scr, int page) 
1994/0803    
{ 
1997/1101    
	lock(&scr->devlock); 
	s3pageset(scr, page); 
	unlock(&scr->devlock); 
1998/0116    
	int id; 
 
	id = (vgaxi(Crtx, 0x30)<<8)|vgaxi(Crtx, 0x2E); 
	switch(id){ 
 
	case 0xE110:				/* ViRGE/GX2 */ 
		break; 
 
	default: 
		lock(&scr->devlock); 
		s3pageset(scr, page); 
		unlock(&scr->devlock); 
		break; 
	} 
1997/1101    
} 
 
static ulong 
1997/1101/sys/src/9/pc/vgas3.c:109,1151998/0116/sys/src/9/pc/vgas3.c:120,126
1994/0803    
static void 
1997/1101    
s3enable(VGAscr* scr) 
1997/0327    
{ 
1994/0803    
	int i; 
1998/0116    
	int i, id; 
1997/1101    
	ulong storage; 
1994/0803    
 
1997/1101    
	s3disable(scr); 
1997/1101/sys/src/9/pc/vgas3.c:117,1331998/0116/sys/src/9/pc/vgas3.c:128,158
1994/0803    
	/* 
	 * Cursor colours. Set both the CR0[EF] and the colour 
	 * stack in case we are using a 16-bit RAMDAC. 
1994/0804    
	 * Why are these colours reversed? 
1998/0116    
	 * This stuff is just a mystery for the ViRGE/GX2. 
1994/0803    
	 */ 
1995/0126    
	vgaxo(Crtx, 0x0E, Pwhite); 
	vgaxo(Crtx, 0x0F, Pblack); 
1994/0803    
	vgaxi(Crtx, 0x45); 
	for(i = 0; i < 4; i++) 
1995/0126    
		vgaxo(Crtx, 0x4A, Pwhite); 
1994/0803    
	vgaxi(Crtx, 0x45); 
	for(i = 0; i < 4; i++) 
1995/0126    
		vgaxo(Crtx, 0x4B, Pblack); 
1998/0116    
	id = (vgaxi(Crtx, 0x30)<<8)|vgaxi(Crtx, 0x2E); 
	switch(id){ 
1994/0803    
 
1998/0116    
	case 0xE110:				/* ViRGE/GX2 */ 
		for(i = 0; i < 3; i++) 
			vgaxo(Crtx, 0x4A, Pblack); 
		vgaxi(Crtx, 0x45); 
		for(i = 0; i < 3; i++) 
			vgaxo(Crtx, 0x4B, Pwhite); 
		break; 
 
	default: 
		for(i = 0; i < 3; i++) 
			vgaxo(Crtx, 0x4A, Pwhite); 
		vgaxi(Crtx, 0x45); 
		for(i = 0; i < 3; i++) 
			vgaxo(Crtx, 0x4B, Pblack); 
		break; 
	} 
 
1994/0803    
	/* 
	 * Find a place for the cursor data in display memory. 
	 * Must be on a 1024-byte boundary. 
1997/1101/sys/src/9/pc/vgas3.c:139,1471998/0116/sys/src/9/pc/vgas3.c:164,172
1997/1101    
	scr->storage = storage; 
1994/0803    
 
	/* 
	 * Enable the cursor in X11 mode. 
1998/0116    
	 * Enable the cursor in Microsoft Windows format. 
1994/0803    
	 */ 
	vgaxo(Crtx, 0x55, vgaxi(Crtx, 0x55)|0x10); 
1998/0116    
	vgaxo(Crtx, 0x55, vgaxi(Crtx, 0x55) & ~0x10); 
1997/1101    
	s3vsyncactive(); 
1994/0803    
	vgaxo(Crtx, 0x45, 0x01); 
} 
1997/1101/sys/src/9/pc/vgas3.c:150,1781998/0116/sys/src/9/pc/vgas3.c:175,212
1997/1101    
s3load(VGAscr* scr, Cursor* curs) 
1994/0803    
{ 
1994/0804    
	uchar *p; 
1997/1101    
	int opage, x, y; 
1998/0116    
	int id, opage, x, y; 
1994/0803    
 
	/* 
1997/1101    
	 * Disable the cursor and 
	 * set the pointer to the two planes. 
	 * Is linear addressing turned on? This will determine 
	 * how we access the cursor storage. 
1994/0809    
	 */ 
1997/1101    
	s3disable(scr); 
1994/0809    
 
1998/0116    
	opage = 0; 
1997/1101    
	p = KADDR(scr->aperture); 
	lock(&scr->devlock); 
	opage = s3pageset(scr, scr->storage>>16); 
	p += (scr->storage & 0xFFFF); 
1998/0116    
	id = (vgaxi(Crtx, 0x30)<<8)|vgaxi(Crtx, 0x2E); 
	switch(id){ 
1994/0803    
 
1998/0116    
	case 0xE110:				/* ViRGE/GX2 */ 
		p += scr->storage; 
		break; 
 
	default: 
		lock(&scr->devlock); 
		opage = s3pageset(scr, scr->storage>>16); 
		p += (scr->storage & 0xFFFF); 
		break; 
	} 
 
1994/0803    
	/* 
	 * The cursor is set in X11 mode which gives the following 
	 * truth table: 
1998/0116    
	 * The cursor is set in Microsoft Windows format (the ViRGE/GX2 no 
	 * longer supports the X11 format) which gives the following truth table: 
1994/0803    
	 *	and xor	colour 
	 *	 0   0	underlying pixel colour 
	 *	 0   1	underlying pixel colour 
	 *	 1   0	background colour 
	 *	 1   1	foreground colour 
1998/0116    
	 *	 0   0	background colour 
	 *	 0   1	foreground colour 
	 *	 1   0	current screen pixel 
	 *	 1   1	NOT current screen pixel 
1994/0803    
	 * Put the cursor into the top-left of the 64x64 array. 
1994/0809    
	 * 
	 * The cursor pattern in memory is interleaved words of 
1997/1101/sys/src/9/pc/vgas3.c:181,2021998/0116/sys/src/9/pc/vgas3.c:215,244
1994/0803    
	for(y = 0; y < 64; y++){ 
1994/0804    
		for(x = 0; x < 64/8; x += 2){ 
			if(x < 16/8 && y < 16){ 
1997/1101    
				*p++ = curs->clr[2*y + x]|curs->set[2*y + x]; 
				*p++ = curs->clr[2*y + x+1]|curs->set[2*y + x+1]; 
1998/0116    
				*p++ = ~(curs->clr[2*y + x]|curs->set[2*y + x]); 
				*p++ = ~(curs->clr[2*y + x+1]|curs->set[2*y + x+1]); 
1997/1101    
				*p++ = curs->set[2*y + x]; 
				*p++ = curs->set[2*y + x+1]; 
1994/0803    
			} 
			else { 
1998/0116    
				*p++ = 0xFF; 
				*p++ = 0xFF; 
1994/0804    
				*p++ = 0x00; 
				*p++ = 0x00; 
				*p++ = 0x00; 
				*p++ = 0x00; 
1994/0803    
			} 
		} 
	} 
 
1997/1101    
	s3pageset(scr, opage); 
	unlock(&scr->devlock); 
1998/0116    
	switch(id){ 
 
	case 0xE110:				/* ViRGE/GX2 */ 
		break; 
 
	default: 
		s3pageset(scr, opage); 
		unlock(&scr->devlock); 
		break; 
	} 
1997/1101    
 
1994/0803    
	/* 
1997/1101    
	 * Save the cursor hotpoint and enable the cursor. 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)