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

📄 libfbx-ati.c

📁 libfxb是linux下只写操作framebuffer的一个轻量级的库。
💻 C
字号:
/* *  libfbx-ati.c -- ati optimizations for libfbx *  (C)opyright 2001 U4X Labs * *  Written by: Paul Mundt <lethal@u4xlabs.com> * *  $Id: libfbx-ati.c,v 1.5 2001/03/03 01:34:43 lethal Exp $ * *  	This is the place for all the ati hardware specific *  optimizations for the libfbx system to go. * *  See ChangeLog for modifications, CREDITS for credits. * *  All source herein is copyright U4X Labs and its original author.  *  Any code modifications or additions are (C)opyright the original  *  author and U4X Labs respectively. * *  libfbx is free software; you can redistribute it and/or modify it  *  under the terms of the GNU Lesser General Public License as  *  published by the Free Software Foundation; either version 2.1 of  *  the License, or (at your option) any later version. * *  libfbx is distributed in the hope that it will be useful, but  *  WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  *  GNU Lesser General Public License for more details. * *  You should have received a copy of the GNU Lesser General Public *  License along with libfbx; if not, write to the Free Software  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *  USA */#include <libfbx/libfbx-drivers.h>#include <libfbx/drivers/libfbx-ati.h>#include <libfbx/libfbx.h>static int isaty128 = 0;	/* Default to a non-Rage128 board */static struct fb_driver_ops aty_ops = {	blank:		aty_blank,	fill_rect:	aty_fill_rect,};int fb_module_init(){	fb_map_mmio_region();	/* FIXME: Kludge alert, this could definately be cleaned up */	if (strcmp(fb_screen->driver->id, "ATY Rage128") == 0)		isaty128 = 1;	fb_screen->driver->ops = &aty_ops;	aty_st_le32(FRGD_SRC_FRGD_CLR, fb_screen->text.color);	aty_st_le32(BKGD_SRC_BKGD_CLR, fb_screen->text.bgcolor);	return 0;}void fb_module_exit(){	fb_unmap_mmio_region();}inline void aty_blank(int val){	__u8 gen_ctl = 0;	if (isaty128) {		if (val & 1) gen_ctl |= 2;		if (val & 2) gen_ctl |= 1;		if (val & 3) gen_ctl |= 4;		aty_st_8(CRTC_EXT_CNTL + 1, gen_ctl);	} else {		gen_ctl = aty_ld_8(CRTC_GEN_CNTL);		if (val > 0) {			switch (val - 1) {				case 0: gen_ctl |= 0x40; break;				case 1: gen_ctl |= 0x8;  break;				case 2: gen_ctl |= 0x4;  break;				case 3: gen_ctl |= 0x4c; break;			}		} else {			gen_ctl &= ~(0x4c);		}		aty_st_8(CRTC_GEN_CNTL, gen_ctl);	}}static inline void aty_draw_rect(__s16 x, __s16 y, __u16 width, __u16 height){	aty_wait_fifo(2);	aty_st_le32(DST_X_Y, (x << 16) | y);	aty_st_le32(DST_HEIGHT_WIDTH, (width << 16) | height);}/* FIXME: This'll probably need changing for Rage128 boards! */void aty_fill_rect(__s32 x1, __s32 y1, __s32 x2, __s32 y2, __s32 r, __s32 g, __s32 b, fb_surface *surface){	x1 = MIN(x1, x2);	y1 = MIN(y1, y2);	aty_wait_fifo(3);	aty_st_le32(DP_FRGD_CLR, surface->make_color(r, g, b));	aty_st_le32(DP_SRC, BKGD_SRC_BKGD_CLR |			    FRGD_SRC_FRGD_CLR |			    MONO_SRC_ONE);	aty_st_le32(DST_CNTL, DST_LAST_PEL |			      DST_Y_TOP_TO_BOTTOM |			      DST_X_LEFT_TO_RIGHT);	aty_draw_rect(x1, y1, (x2 - x1), (y2 - y1));}

⌨️ 快捷键说明

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