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

1994/0507/pc/devvga.c (diff list | history)

1994/0506/sys/src/9/pc/devvga.c:132,1401994/0507/sys/src/9/pc/devvga.c:132,138 (short | long | prev | next)
1993/1116    
static void	cgascreenputs(char*, int); 
static void	screenputc(char*); 
static void	scroll(void); 
static ulong	x3to32(uchar); 
static ulong	x6to32(uchar); 
1994/0506    
static void	greyscale(void); 
1994/0507    
static ulong	xnto32(uchar, int); 
1994/0415    
static void	workinit(Bitmap*, int, int); 
1994/0416    
extern void	screenload(Rectangle, uchar*, int, int, int); 
extern void	screenunload(Rectangle, uchar*, int, int, int); 
1994/0506/sys/src/9/pc/devvga.c:309,3161994/0507/sys/src/9/pc/devvga.c:307,312
1994/0503    
		cbuf[n] = 0; 
		if(strncmp(cbuf, "hwcursor", 8) == 0) 
			hwcursor = 1; 
1994/0506    
		else if(strncmp(cbuf, "grey", 4) == 0) 
			greyscale(); 
1994/0503    
		break; 
1992/0527    
	case Qvgasize: 
1992/1119    
		if(offset != 0 || n >= sizeof(cbuf)) 
1994/0506/sys/src/9/pc/devvga.c:591,6031994/0507/sys/src/9/pc/devvga.c:587,602
1993/1116    
	switch(ldepth){ 
	case 3: 
		for(i = 0; i < 256; i++) 
1994/0506    
			setcolor(i, x3to32(i>>5), x3to32(i>>2), x3to32(i|(i<<1))); 
1994/0507    
			setcolor(i, xnto32(i>>5, 3), xnto32(i>>2, 3), xnto32(i<<1, 2)); 
		setcolor(0x55, xnto32(0x15, 6), xnto32(0x15, 6), xnto32(0x15, 6)); 
		setcolor(0xaa, xnto32(0x2a, 6), xnto32(0x2a, 6), xnto32(0x2a, 6)); 
		setcolor(0xff, xnto32(0x3f, 6), xnto32(0x3f, 6), xnto32(0x3f, 6)); 
1993/1116    
		break; 
	case 2: 
	case 1: 
	case 0: 
		for(i = 0; i < 16; i++){ 
			x = x6to32((i*63)/15); 
1994/0507    
			x = xnto32((i*63)/15, 6); 
1993/1116    
			setcolor(i, x, x, x); 
		} 
		break; 
1994/0506/sys/src/9/pc/devvga.c:976,10361994/0507/sys/src/9/pc/devvga.c:975,997
1993/1116    
 
1992/1119    
 
/* 
 *  expand 3 and 6 bits of color to 32 
1994/0507    
 *  expand n bits of color to 32 
1992/1119    
 */ 
static ulong 
x3to32(uchar x) 
1994/0507    
xnto32(uchar x, int n) 
1992/1119    
{ 
1994/0507    
	int s; 
1992/1119    
	ulong y; 
 
	x = x&7; 
	x= (x<<3)|x; 
	y = (x<<(32-6))|(x<<(32-12))|(x<<(32-18))|(x<<(32-24))|(x<<(32-30)); 
1994/0507    
	x &= (1<<n)-1; 
	y = 0; 
	for(s = 32 - n; s > 0; s -= n) 
		y |= x<<s; 
	if(s < 0) 
		y |= x>>(-s); 
1992/1119    
	return y; 
} 
static ulong 
x6to32(uchar x) 
{ 
	ulong y; 
 
	x = x&0x3f; 
	y = (x<<(32-6))|(x<<(32-12))|(x<<(32-18))|(x<<(32-24))|(x<<(32-30)); 
	return y; 
1994/0506    
} 
static ulong 
x8to32(uchar x) 
{ 
	ulong y; 
                 
	x = x&0xff; 
	y = (x<<(32-8))|(x<<(32-16))|(x<<(32-24))|x; 
	return y; 
} 
static void 
greyscale(void) 
{ 
	int i; 
	ulong x; 
                 
	/* default color map (has to be outside the lock) */ 
	switch(gscreen.ldepth){ 
	case 3: 
		for(i = 0; i < 256; i++){ 
			x = x8to32(i); 
			setcolor(i, x, x, x); 
		} 
		break; 
	case 2: 
	case 1: 
	case 0: 
		for(i = 0; i < 16; i++){ 
			x = x6to32((i*63)/15); 
			setcolor(i, x, x, x); 
		} 
		break; 
	} 
1992/1119    
} 
                 
1993/1116    
/* 
1992/1119    
 *  paging routines for different cards 
 */ 
1994/0506/sys/src/9/pc/devvga.c:1364,13701994/0507/sys/src/9/pc/devvga.c:1325,1331
1994/0414    
void 
cursoron(int dolock) 
{ 
1994/0416    
	int xoff, yoff; 
1994/0507    
	int xoff, yoff, s; 
1994/0414    
	Rectangle r; 
	uchar *a; 
	struct { 
1994/0506/sys/src/9/pc/devvga.c:1377,13841994/0507/sys/src/9/pc/devvga.c:1338,1348
1994/0414    
 
	if(cursor.disable) 
		return; 
	if(dolock) 
1994/0507    
	if(dolock){ 
		s = 0;		/* to avoid compiler warning */ 
1994/0414    
		lock(&cursor); 
1994/0507    
	} else 
		s = spllo();	/* to avoid freezing out the eia ports */ 
1994/0414    
 
1994/0503    
	if(hwcursor) 
		(*vgacard->mvcursor)(mousexy()); 
1994/0506/sys/src/9/pc/devvga.c:1430,14501994/0507/sys/src/9/pc/devvga.c:1394,1423
1994/0414    
 
	if(dolock) 
		unlock(&cursor); 
1994/0507    
	else 
		splx(s); 
1994/0414    
} 
 
void 
cursoroff(int dolock) 
{ 
1994/0507    
	int s; 
 
1994/0503    
	if(hwcursor) 
		return; 
1994/0414    
	if(cursor.disable) 
		return; 
	if(dolock) 
1994/0507    
	if(dolock){ 
		s = 0;		/* to avoid a compiler warning */ 
1994/0414    
		lock(&cursor); 
1994/0507    
	} else 
		s = spllo();	/* to avoid freezing out the eia ports */ 
1994/0414    
	if(--cursor.visible == 0 && cursor.tl > 0) 
		screenload(cursor.clipr, (uchar*)backbits, cursor.tl, cursor.l, 0); 
	if(dolock) 
		unlock(&cursor); 
1994/0507    
	else 
		splx(s); 
1994/0414    
} 
 
1994/0415    
static void 


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