⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matroxfb_accel.c

📁 linux-2.4.29操作系统的源码
💻 C
📖 第 1 页 / 共 3 页
字号:
	ar0 = fontwidth(p) - 1;	mga_outl(M_FXBNDRY, ((xx+ar0)<<16) | xx);	if (fontwidth(p) <= 8)		step = 1;	else if (fontwidth(p) <= 16)		step = 2;	else		step = 4;	if (fontwidth(p) == step << 3) {		size_t charcell = fontheight(p)*step;		/* TODO: Align charcell to 4B for BE */		mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE);		mga_outl(M_FCOL, fgx);		mga_outl(M_BCOL, bgx);		mga_outl(M_AR3, 0);		mga_outl(M_AR0, fontheight(p)*fontwidth(p)-1);		mga_ydstlen(yy, fontheight(p));		mga_memcpy_toio(ACCESS_FBINFO(mmio.vbase), 0, p->fontdata+(c&p->charmask)*charcell, charcell);	} else {		u8* chardata = p->fontdata+(c&p->charmask)*fontheight(p)*step;		int i;		mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_REPLACE);		mga_outl(M_FCOL, fgx);		mga_outl(M_BCOL, bgx);		mga_outl(M_AR5, 0);		mga_outl(M_AR3, 0);		mga_outl(M_AR0, ar0);		mga_ydstlen(yy, fontheight(p));		switch (step) {		case 1:			for (i = fontheight(p); i > 0; i--) {#ifdef __LITTLE_ENDIAN				mga_outl(0, *chardata++);#else				mga_outl(0, (*chardata++) << 24);#endif			}			break;		case 2:			for (i = fontheight(p); i > 0; i--) {#ifdef __LITTLE_ENDIAN				mga_outl(0, *(u_int16_t*)chardata);#else				mga_outl(0, (*(u_int16_t*)chardata) << 16);#endif				chardata += 2;			}			break;		case 4:			mga_memcpy_toio(ACCESS_FBINFO(mmio.vbase), 0, chardata, fontheight(p) * 4);			break;		}	}	WaitTillIdle();#ifdef __BIG_ENDIAN	mga_outl(M_OPMODE, ACCESS_FBINFO(accel.m_opmode));#endif	CRITEND}#ifdef FBCON_HAS_CFB8static void matrox_cfb8_putc(struct vc_data* conp, struct display* p, int c, int yy, int xx) {	u_int32_t fgx, bgx;	MINFO_FROM_DISP(p);	DBG_HEAVY("matroxfb_cfb8_putc");	fgx = attr_fgcol(p, c);	bgx = attr_bgcol(p, c);	fgx |= (fgx << 8);	fgx |= (fgx << 16);	bgx |= (bgx << 8);	bgx |= (bgx << 16);	ACCESS_FBINFO(curr.putc)(fgx, bgx, p, c, yy, xx);}#endif#ifdef FBCON_HAS_CFB16static void matrox_cfb16_putc(struct vc_data* conp, struct display* p, int c, int yy, int xx) {	u_int32_t fgx, bgx;	MINFO_FROM_DISP(p);	DBG_HEAVY("matroxfb_cfb16_putc");	fgx = ((u_int16_t*)p->dispsw_data)[attr_fgcol(p, c)];	bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol(p, c)];	fgx |= (fgx << 16);	bgx |= (bgx << 16);	ACCESS_FBINFO(curr.putc)(fgx, bgx, p, c, yy, xx);}#endif#if defined(FBCON_HAS_CFB32) || defined(FBCON_HAS_CFB24)static void matrox_cfb32_putc(struct vc_data* conp, struct display* p, int c, int yy, int xx) {	u_int32_t fgx, bgx;	MINFO_FROM_DISP(p);	DBG_HEAVY("matroxfb_cfb32_putc");	fgx = ((u_int32_t*)p->dispsw_data)[attr_fgcol(p, c)];	bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol(p, c)];	ACCESS_FBINFO(curr.putc)(fgx, bgx, p, c, yy, xx);}#endifstatic void matrox_cfbX_fastputcs(u_int32_t fgx, u_int32_t bgx, struct display* p, const unsigned short* s, int count, int yy, int xx) {	unsigned int charcell;	CRITFLAGS	MINFO_FROM_DISP(p);	yy *= fontheight(p);	xx *= fontwidth(p);	charcell = fontwidth(p) * fontheight(p);	CRITBEGIN	mga_fifo(3);	mga_outl(M_DWGCTL, M_DWG_BITBLT | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE);	mga_outl(M_FCOL, fgx);	mga_outl(M_BCOL, bgx);	while (count--) {		u_int32_t ar3 = ACCESS_FBINFO(fastfont.mgabase) + (scr_readw(s++) & p->charmask)*charcell;		mga_fifo(4);		mga_outl(M_FXBNDRY, ((xx + fontwidth(p) - 1) << 16) | xx);		mga_outl(M_AR3, ar3);		mga_outl(M_AR0, (ar3 + charcell - 1) & 0x0003FFFF);		mga_ydstlen(yy, fontheight(p));		xx += fontwidth(p);	}	WaitTillIdle();	CRITEND}static void matrox_cfbX_putcs(u_int32_t fgx, u_int32_t bgx, struct display* p, const unsigned short* s, int count, int yy, int xx) {	u_int32_t step;	u_int32_t ydstlen;	u_int32_t xlen;	u_int32_t ar0;	u_int32_t charcell;	u_int32_t fxbndry;	vaddr_t mmio;	int easy;	CRITFLAGS	MINFO_FROM_DISP(p);	DBG_HEAVY("matroxfb_cfbX_putcs");	yy *= fontheight(p);	xx *= fontwidth(p);	if (fontwidth(p) <= 8)		step = 1;	else if (fontwidth(p) <= 16)		step = 2;	else		step = 4;	charcell = fontheight(p)*step;	xlen = (charcell + 3) & ~3;	ydstlen = (yy << 16) | fontheight(p);	if (fontwidth(p) == step << 3) {		ar0 = fontheight(p)*fontwidth(p) - 1;		easy = 1;	} else {		ar0 = fontwidth(p) - 1;		easy = 0;	}	CRITBEGIN#ifdef __BIG_ENDIAN	WaitTillIdle();	mga_outl(M_OPMODE, M_OPMODE_8BPP);#else	mga_fifo(3);#endif	if (easy)		mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_LINEAR | M_DWG_REPLACE);	else		mga_outl(M_DWGCTL, M_DWG_ILOAD | M_DWG_SGNZERO | M_DWG_SHIFTZERO | M_DWG_BMONOWF | M_DWG_REPLACE);	mga_outl(M_FCOL, fgx);	mga_outl(M_BCOL, bgx);	fxbndry = ((xx + fontwidth(p) - 1) << 16) | xx;	mmio = ACCESS_FBINFO(mmio.vbase);	while (count--) {		u_int8_t* chardata = p->fontdata + (scr_readw(s++) & p->charmask)*charcell;		mga_fifo(6);		mga_writel(mmio, M_FXBNDRY, fxbndry);		mga_writel(mmio, M_AR0, ar0);		mga_writel(mmio, M_AR3, 0);		if (easy) {			mga_writel(mmio, M_YDSTLEN | M_EXEC, ydstlen);			mga_memcpy_toio(mmio, 0, chardata, xlen);		} else {			mga_writel(mmio, M_AR5, 0);			mga_writel(mmio, M_YDSTLEN | M_EXEC, ydstlen);			switch (step) {				case 1:	{						u_int8_t* charend = chardata + charcell;						for (; chardata != charend; chardata++) {#ifdef __LITTLE_ENDIAN							mga_writel(mmio, 0, *chardata);#else							mga_writel(mmio, 0, (*chardata) << 24);#endif						}					}					break;				case 2:	{						u_int8_t* charend = chardata + charcell;						for (; chardata != charend; chardata += 2) {#ifdef __LITTLE_ENDIAN							mga_writel(mmio, 0, *(u_int16_t*)chardata);#else							mga_writel(mmio, 0, (*(u_int16_t*)chardata) << 16);#endif						}					}					break;				default:					mga_memcpy_toio(mmio, 0, chardata, charcell);					break;			}		}		fxbndry += fontwidth(p) + (fontwidth(p) << 16);	}	WaitTillIdle();#ifdef __BIG_ENDIAN	mga_outl(M_OPMODE, ACCESS_FBINFO(accel.m_opmode));#endif	CRITEND}#ifdef FBCON_HAS_CFB8static void matrox_cfb8_putcs(struct vc_data* conp, struct display* p, const unsigned short* s, int count, int yy, int xx) {	u_int16_t c;	u_int32_t fgx, bgx;	MINFO_FROM_DISP(p);	DBG_HEAVY("matroxfb_cfb8_putcs");	c = scr_readw(s);	fgx = attr_fgcol(p, c);	bgx = attr_bgcol(p, c);	fgx |= (fgx << 8);	fgx |= (fgx << 16);	bgx |= (bgx << 8);	bgx |= (bgx << 16);	ACCESS_FBINFO(curr.putcs)(fgx, bgx, p, s, count, yy, xx);}#endif#ifdef FBCON_HAS_CFB16static void matrox_cfb16_putcs(struct vc_data* conp, struct display* p, const unsigned short* s, int count, int yy, int xx) {	u_int16_t c;	u_int32_t fgx, bgx;	MINFO_FROM_DISP(p);	DBG_HEAVY("matroxfb_cfb16_putcs");	c = scr_readw(s);	fgx = ((u_int16_t*)p->dispsw_data)[attr_fgcol(p, c)];	bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol(p, c)];	fgx |= (fgx << 16);	bgx |= (bgx << 16);	ACCESS_FBINFO(curr.putcs)(fgx, bgx, p, s, count, yy, xx);}#endif#if defined(FBCON_HAS_CFB32) || defined(FBCON_HAS_CFB24)static void matrox_cfb32_putcs(struct vc_data* conp, struct display* p, const unsigned short* s, int count, int yy, int xx) {	u_int16_t c;	u_int32_t fgx, bgx;	MINFO_FROM_DISP(p);	DBG_HEAVY("matroxfb_cfb32_putcs");	c = scr_readw(s);	fgx = ((u_int32_t*)p->dispsw_data)[attr_fgcol(p, c)];	bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol(p, c)];	ACCESS_FBINFO(curr.putcs)(fgx, bgx, p, s, count, yy, xx);}#endif#ifdef FBCON_HAS_CFB4static void matrox_cfb4_revc(struct display* p, int xx, int yy) {	CRITFLAGS	MINFO_FROM_DISP(p);	DBG_LOOP("matroxfb_cfb4_revc");	if (fontwidth(p) & 1) {		fbcon_cfb4_revc(p, xx, yy);		return;	}	yy *= fontheight(p);	xx *= fontwidth(p);	xx |= (xx + fontwidth(p)) << 16;	xx >>= 1;	CRITBEGIN	mga_fifo(5);	mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_XOR);	mga_outl(M_FCOL, 0xFFFFFFFF);	mga_outl(M_FXBNDRY, xx);	mga_outl(M_YDST, yy * p->var.xres_virtual >> 6);	mga_outl(M_LEN | M_EXEC, fontheight(p));	WaitTillIdle();	CRITEND}#endif#ifdef FBCON_HAS_CFB8static void matrox_cfb8_revc(struct display* p, int xx, int yy) {	CRITFLAGS	MINFO_FROM_DISP(p);	DBG_LOOP("matrox_cfb8_revc")	yy *= fontheight(p);	xx *= fontwidth(p);	CRITBEGIN	mga_fifo(4);	mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_XOR);	mga_outl(M_FCOL, 0x0F0F0F0F);	mga_outl(M_FXBNDRY, ((xx + fontwidth(p)) << 16) | xx);	mga_ydstlen(yy, fontheight(p));	WaitTillIdle();	CRITEND}#endif#if defined(FBCON_HAS_CFB16) || defined(FBCON_HAS_CFB24) || defined(FBCON_HAS_CFB32)static void matrox_cfbX_revc(struct display* p, int xx, int yy) {	CRITFLAGS	MINFO_FROM_DISP(p);	DBG_LOOP("matrox_cfbX_revc")	yy *= fontheight(p);	xx *= fontwidth(p);	CRITBEGIN	mga_fifo(4);	mga_outl(M_DWGCTL, ACCESS_FBINFO(accel.m_dwg_rect) | M_DWG_XOR);	mga_outl(M_FCOL, 0xFFFFFFFF);	mga_outl(M_FXBNDRY, ((xx + fontwidth(p)) << 16) | xx);	mga_ydstlen(yy, fontheight(p));	WaitTillIdle();	CRITEND}#endifstatic void matrox_cfbX_clear_margins(struct vc_data* conp, struct display* p, int bottom_only) {	unsigned int bottom_height, right_width;	unsigned int bottom_start, right_start;	unsigned int cell_h, cell_w;	DBG("matrox_cfbX_clear_margins")	cell_w = fontwidth(p);	if (!cell_w) return;	/* PARANOID */	right_width = p->var.xres % cell_w;	right_start = p->var.xres - right_width;	if (!bottom_only && right_width) {		/* clear whole right margin, not only visible portion */		matroxfb_accel_clear(     PMXINFO(p)			     /* color */  0x00000000,			     /* y */      0,			     /* x */      p->var.xoffset + right_start,			     /* height */ p->var.yres_virtual,			     /* width */  right_width);	}	cell_h = fontheight(p);	if (!cell_h) return;	/* PARANOID */	bottom_height = p->var.yres % cell_h;	if (bottom_height) {		bottom_start = p->var.yres - bottom_height;		matroxfb_accel_clear(		  PMXINFO(p)				     /* color */  0x00000000,				     /* y */	  p->var.yoffset + bottom_start,				     /* x */	  p->var.xoffset,				     /* height */ bottom_height,				     /* width */  right_start);	}}static void matrox_text_setup(struct display* p) {	MINFO_FROM_DISP(p);	p->next_line = p->line_length ? p->line_length : ((p->var.xres_virtual / (fontwidth(p)?fontwidth(p):8)) * ACCESS_FBINFO(devflags.textstep));	p->next_plane = 0;}static void matrox_text_bmove(struct display* p, int sy, int sx, int dy, int dx,		int height, int width) {	unsigned int srcoff;	unsigned int dstoff;	unsigned int step;	CRITFLAGS	MINFO_FROM_DISP(p);	CRITBEGIN	step = ACCESS_FBINFO(devflags.textstep);	srcoff = (sy * p->next_line) + (sx * step);	dstoff = (dy * p->next_line) + (dx * step);	if (dstoff < srcoff) {		while (height > 0) {			int i;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -