diff options
| author | Frans Meulenbroeks <fransmeulenbroeks@gmail.com> | 2010-01-06 21:32:39 +0100 |
|---|---|---|
| committer | Frans Meulenbroeks <fransmeulenbroeks@gmail.com> | 2010-01-06 21:32:39 +0100 |
| commit | b2a6f7304b70600e5c9b131c353b81346b82158d (patch) | |
| tree | 4c355cc06586aece4351f2cc586f81e5e79d03ed /recipes/linux/linux-kirkwood/openrd-client | |
| parent | c7ed94a12cdcc4b8e98698683022ac1bd328ef0c (diff) | |
linux-kirkwood: moved kernel to 2.6.33-rc1
added patches for video and audio for openrd client
made some configuration changes in defconfig to support those
Diffstat (limited to 'recipes/linux/linux-kirkwood/openrd-client')
| -rw-r--r-- | recipes/linux/linux-kirkwood/openrd-client/0002-OpenRD-Client-Volari-Z11-driver-added.patch | 29767 | ||||
| -rw-r--r-- | recipes/linux/linux-kirkwood/openrd-client/defconfig | 1292 |
2 files changed, 30097 insertions, 962 deletions
diff --git a/recipes/linux/linux-kirkwood/openrd-client/0002-OpenRD-Client-Volari-Z11-driver-added.patch b/recipes/linux/linux-kirkwood/openrd-client/0002-OpenRD-Client-Volari-Z11-driver-added.patch new file mode 100644 index 0000000000..a10c4e8fd4 --- /dev/null +++ b/recipes/linux/linux-kirkwood/openrd-client/0002-OpenRD-Client-Volari-Z11-driver-added.patch @@ -0,0 +1,29767 @@ +From 2ef775d5351693d62e45eefb78408f5a20b2c0ba Mon Sep 17 00:00:00 2001 +From: Tanmay Upadhyay <tanmay.upadhyay@einfochips.com> +Date: Wed, 2 Dec 2009 10:54:13 +0530 +Subject: [PATCH] OpenRD-Client: Volari Z11 driver added + +The code is the same as the one present in 2.6.22.18 kernel. Compilation is a +bit noisy. But this is a temporary stuff to get going till XGI provides the +mail line driver. + +Signed-off-by: Tanmay Upadhyay <tanmay.upadhyay@einfochips.com> +--- + drivers/video/Kconfig | 12 + + drivers/video/Makefile | 1 + + drivers/video/xgi/Makefile | 4 + + drivers/video/xgi/XGI.h | 10 + + drivers/video/xgi/XGI_accel.c | 596 +++ + drivers/video/xgi/XGI_accel.h | 511 ++ + drivers/video/xgi/XGI_main.h | 1042 ++++ + drivers/video/xgi/XGI_main_26.c | 3789 +++++++++++++ + drivers/video/xgi/XGIfb.h | 215 + + drivers/video/xgi/floatlib.c | 946 ++++ + drivers/video/xgi/osdef.h | 153 + + drivers/video/xgi/vb_def.h | 1017 ++++ + drivers/video/xgi/vb_ext.c | 1375 +++++ + drivers/video/xgi/vb_ext.h | 32 + + drivers/video/xgi/vb_init.c | 3376 ++++++++++++ + drivers/video/xgi/vb_init.h | 7 + + drivers/video/xgi/vb_release.txt | 44 + + drivers/video/xgi/vb_setmode.c |10828 ++++++++++++++++++++++++++++++++++++++ + drivers/video/xgi/vb_setmode.h | 40 + + drivers/video/xgi/vb_struct.h | 518 ++ + drivers/video/xgi/vb_table.h | 4406 ++++++++++++++++ + drivers/video/xgi/vb_util.c | 287 + + drivers/video/xgi/vb_util.h | 16 + + drivers/video/xgi/vgatypes.h | 325 ++ + 24 files changed, 29550 insertions(+), 0 deletions(-) + create mode 100644 drivers/video/xgi/Makefile + create mode 100644 drivers/video/xgi/XGI.h + create mode 100644 drivers/video/xgi/XGI_accel.c + create mode 100644 drivers/video/xgi/XGI_accel.h + create mode 100644 drivers/video/xgi/XGI_main.h + create mode 100644 drivers/video/xgi/XGI_main_26.c + create mode 100644 drivers/video/xgi/XGIfb.h + create mode 100644 drivers/video/xgi/floatlib.c + create mode 100644 drivers/video/xgi/osdef.h + create mode 100644 drivers/video/xgi/vb_def.h + create mode 100644 drivers/video/xgi/vb_ext.c + create mode 100644 drivers/video/xgi/vb_ext.h + create mode 100644 drivers/video/xgi/vb_init.c + create mode 100644 drivers/video/xgi/vb_init.h + create mode 100644 drivers/video/xgi/vb_release.txt + create mode 100644 drivers/video/xgi/vb_setmode.c + create mode 100644 drivers/video/xgi/vb_setmode.h + create mode 100644 drivers/video/xgi/vb_struct.h + create mode 100644 drivers/video/xgi/vb_table.h + create mode 100644 drivers/video/xgi/vb_util.c + create mode 100644 drivers/video/xgi/vb_util.h + create mode 100644 drivers/video/xgi/vgatypes.h + +diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig +index 5a5c303..f47305c 100644 +--- a/drivers/video/Kconfig ++++ b/drivers/video/Kconfig +@@ -1488,6 +1488,18 @@ config FB_SIS_315 + (315/H/PRO, 55x, 650, 651, 740, 330, 661, 741, 760, 761) as well + as XGI V3XT, V5, V8 and Z7. + ++config FB_XGI ++ tristate "XGI display support" ++ depends on FB && PCI ++ select FB_CFB_FILLRECT ++ select FB_CFB_COPYAREA ++ select FB_CFB_IMAGEBLIT ++ help ++ This driver supports notebooks with XGI PCI chips. ++ Say Y if you have such a graphics card. ++ To compile this driver as a module, choose M here: the ++ module will be called XGIfb. ++ + config FB_VIA + tristate "VIA UniChrome (Pro) and Chrome9 display support" + depends on FB && PCI +diff --git a/drivers/video/Makefile b/drivers/video/Makefile +index 4ecb30c..36efbdd 100644 +--- a/drivers/video/Makefile ++++ b/drivers/video/Makefile +@@ -42,6 +42,7 @@ obj-$(CONFIG_FB_ATY) += aty/ macmodes.o + obj-$(CONFIG_FB_ATY128) += aty/ macmodes.o + obj-$(CONFIG_FB_RADEON) += aty/ + obj-$(CONFIG_FB_SIS) += sis/ ++obj-$(CONFIG_FB_XGI) += xgi/ + obj-$(CONFIG_FB_VIA) += via/ + obj-$(CONFIG_FB_KYRO) += kyro/ + obj-$(CONFIG_FB_SAVAGE) += savage/ +diff --git a/drivers/video/xgi/Makefile b/drivers/video/xgi/Makefile +new file mode 100644 +index 0000000..b5375fc +--- /dev/null ++++ b/drivers/video/xgi/Makefile +@@ -0,0 +1,4 @@ ++obj-$(CONFIG_FB_XGI) += XGIfb.o ++ ++XGIfb-objs := XGI_main_26.o XGI_accel.o vb_init.o vb_setmode.o vb_util.o vb_ext.o floatlib.o ++ +diff --git a/drivers/video/xgi/XGI.h b/drivers/video/xgi/XGI.h +new file mode 100644 +index 0000000..87803dd +--- /dev/null ++++ b/drivers/video/xgi/XGI.h +@@ -0,0 +1,10 @@ ++#ifndef _XGI_H ++#define _XGI_H ++ ++#if 1 ++#define TWDEBUG(x) ++#else ++#define TWDEBUG(x) printk(KERN_INFO x "\n"); ++#endif ++ ++#endif +diff --git a/drivers/video/xgi/XGI_accel.c b/drivers/video/xgi/XGI_accel.c +new file mode 100644 +index 0000000..6bbb3bf +--- /dev/null ++++ b/drivers/video/xgi/XGI_accel.c +@@ -0,0 +1,596 @@ ++/* ++ * XGI 300/630/730/540/315/550/650/740 frame buffer driver ++ * for Linux kernels 2.4.x and 2.5.x ++ * ++ * 2D acceleration part ++ * ++ * Based on the X driver's XGI300_accel.c which is ++ * Copyright Xavier Ducoin <x.ducoin@lectra.com> ++ * Copyright 2002 by Thomas Winischhofer, Vienna, Austria ++ * and XGI310_accel.c which is ++ * Copyright 2002 by Thomas Winischhofer, Vienna, Austria ++ * ++ * Author: Thomas Winischhofer <thomas@winischhofer.net> ++ * (see http://www.winischhofer.net/ ++ * for more information and updates) ++ */ ++ ++//#include <linux/config.h> ++#include <linux/version.h> ++#include <linux/module.h> ++#include <linux/kernel.h> ++#include <linux/errno.h> ++#include <linux/string.h> ++#include <linux/mm.h> ++#include <linux/tty.h> ++#include <linux/slab.h> ++#include <linux/delay.h> ++#include <linux/fb.h> ++#include <linux/console.h> ++#include <linux/selection.h> ++#include <linux/ioport.h> ++#include <linux/init.h> ++#include <linux/pci.h> ++#include <linux/vt_kern.h> ++#include <linux/capability.h> ++#include <linux/fs.h> ++#include <linux/agp_backend.h> ++ ++#include <linux/types.h> ++/* ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) ++#include <linux/XGIfb.h> ++#else ++#include <video/XGIfb.h> ++#endif ++*/ ++#include <asm/io.h> ++ ++#ifdef CONFIG_MTRR ++#include <asm/mtrr.h> ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) ++#include <video/fbcon.h> ++#include <video/fbcon-cfb8.h> ++#include <video/fbcon-cfb16.h> ++#include <video/fbcon-cfb24.h> ++#include <video/fbcon-cfb32.h> ++#endif ++ ++#include "osdef.h" ++#include "vgatypes.h" ++#include "vb_struct.h" ++#include "XGIfb.h" ++#include "XGI_accel.h" ++ ++ ++extern struct video_info xgi_video_info; ++extern int XGIfb_accel; ++ ++static const int XGIALUConv[] = ++{ ++ 0x00, /* dest = 0; 0, GXclear, 0 */ ++ 0x88, /* dest &= src; DSa, GXand, 0x1 */ ++ 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ ++ 0xCC, /* dest = src; S, GXcopy, 0x3 */ ++ 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ ++ 0xAA, /* dest = dest; D, GXnoop, 0x5 */ ++ 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ ++ 0xEE, /* dest |= src; DSo, GXor, 0x7 */ ++ 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ ++ 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ ++ 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ ++ 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ ++ 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ ++ 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ ++ 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ ++ 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ ++}; ++/* same ROP but with Pattern as Source */ ++static const int XGIPatALUConv[] = ++{ ++ 0x00, /* dest = 0; 0, GXclear, 0 */ ++ 0xA0, /* dest &= src; DPa, GXand, 0x1 */ ++ 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ ++ 0xF0, /* dest = src; P, GXcopy, 0x3 */ ++ 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ ++ 0xAA, /* dest = dest; D, GXnoop, 0x5 */ ++ 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ ++ 0xFA, /* dest |= src; DPo, GXor, 0x7 */ ++ 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ ++ 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ ++ 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ ++ 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ ++ 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ ++ 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ ++ 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ ++ 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ ++}; ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34) ++static const unsigned char myrops[] = { ++ 3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 ++ }; ++#endif ++ ++/* 300 series */ ++ ++static void ++XGI300Sync(void) ++{ ++ XGI300Idle ++} ++ ++static void ++XGI310Sync(void) ++{ ++ XGI310Idle ++} ++ ++static void ++XGI300SetupForScreenToScreenCopy(int xdir, int ydir, int rop, ++ unsigned int planemask, int trans_color) ++{ ++ XGI300SetupDSTColorDepth(xgi_video_info.DstColor); ++ XGI300SetupSRCPitch(xgi_video_info.video_linelength) ++ XGI300SetupDSTRect(xgi_video_info.video_linelength, 0xFFF) ++ ++ if(trans_color != -1) { ++ XGI300SetupROP(0x0A) ++ XGI300SetupSRCTrans(trans_color) ++ XGI300SetupCMDFlag(TRANSPARENT_BITBLT) ++ } else { ++ XGI300SetupROP(XGIALUConv[rop]) ++ } ++ if(xdir > 0) { ++ XGI300SetupCMDFlag(X_INC) ++ } ++ if(ydir > 0) { ++ XGI300SetupCMDFlag(Y_INC) ++ } ++} ++ ++static void ++XGI300SubsequentScreenToScreenCopy(int src_x, int src_y, int dst_x, int dst_y, ++ int width, int height) ++{ ++ long srcbase, dstbase; ++ ++ srcbase = dstbase = 0; ++ if (src_y >= 2048) { ++ srcbase = xgi_video_info.video_linelength * src_y; ++ src_y = 0; ++ } ++ if (dst_y >= 2048) { ++ dstbase = xgi_video_info.video_linelength * dst_y; ++ dst_y = 0; ++ } ++ ++ XGI300SetupSRCBase(srcbase); ++ XGI300SetupDSTBase(dstbase); ++ ++ if(!(xgi_video_info.CommandReg & X_INC)) { ++ src_x += width-1; ++ dst_x += width-1; ++ } ++ if(!(xgi_video_info.CommandReg & Y_INC)) { ++ src_y += height-1; ++ dst_y += height-1; ++ } ++ XGI300SetupRect(width, height) ++ XGI300SetupSRCXY(src_x, src_y) ++ XGI300SetupDSTXY(dst_x, dst_y) ++ XGI300DoCMD ++} ++ ++static void ++XGI300SetupForSolidFill(int color, int rop, unsigned int planemask) ++{ ++ XGI300SetupPATFG(color) ++ XGI300SetupDSTRect(xgi_video_info.video_linelength, 0xFFF) ++ XGI300SetupDSTColorDepth(xgi_video_info.DstColor); ++ XGI300SetupROP(XGIPatALUConv[rop]) ++ XGI300SetupCMDFlag(PATFG) ++} ++ ++static void ++XGI300SubsequentSolidFillRect(int x, int y, int w, int h) ++{ ++ long dstbase; ++ ++ dstbase = 0; ++ if(y >= 2048) { ++ dstbase = xgi_video_info.video_linelength * y; ++ y = 0; ++ } ++ XGI300SetupDSTBase(dstbase) ++ XGI300SetupDSTXY(x,y) ++ XGI300SetupRect(w,h) ++ XGI300SetupCMDFlag(X_INC | Y_INC | BITBLT) ++ XGI300DoCMD ++} ++ ++/* 310/325 series ------------------------------------------------ */ ++ ++static void ++XGI310SetupForScreenToScreenCopy(int xdir, int ydir, int rop, ++ unsigned int planemask, int trans_color) ++{ ++ XGI310SetupDSTColorDepth(xgi_video_info.DstColor); ++ XGI310SetupSRCPitch(xgi_video_info.video_linelength) ++ XGI310SetupDSTRect(xgi_video_info.video_linelength, 0xFFF) ++ if (trans_color != -1) { ++ XGI310SetupROP(0x0A) ++ XGI310SetupSRCTrans(trans_color) ++ XGI310SetupCMDFlag(TRANSPARENT_BITBLT) ++ } else { ++ XGI310SetupROP(XGIALUConv[rop]) ++ /* Set command - not needed, both 0 */ ++ /* XGISetupCMDFlag(BITBLT | SRCVIDEO) */ ++ } ++ XGI310SetupCMDFlag(xgi_video_info.XGI310_AccelDepth) ++ /* TW: The 310/325 series is smart enough to know the direction */ ++} ++ ++static void ++XGI310SubsequentScreenToScreenCopy(int src_x, int src_y, int dst_x, int dst_y, ++ int width, int height) ++{ ++ long srcbase, dstbase; ++ int mymin, mymax; ++ ++ srcbase = dstbase = 0; ++ mymin = min(src_y, dst_y); ++ mymax = max(src_y, dst_y); ++ ++ /* Although the chip knows the direction to use ++ * if the source and destination areas overlap, ++ * that logic fails if we fiddle with the bitmap ++ * addresses. Therefore, we check if the source ++ * and destination blitting areas overlap and ++ * adapt the bitmap addresses synchronously ++ * if the coordinates exceed the valid range. ++ * The the areas do not overlap, we do our ++ * normal check. ++ */ ++ if((mymax - mymin) < height) { ++ if((src_y >= 2048) || (dst_y >= 2048)) { ++ srcbase = xgi_video_info.video_linelength * mymin; ++ dstbase = xgi_video_info.video_linelength * mymin; ++ src_y -= mymin; ++ dst_y -= mymin; ++ } ++ } else { ++ if(src_y >= 2048) { ++ srcbase = xgi_video_info.video_linelength * src_y; ++ src_y = 0; ++ } ++ if(dst_y >= 2048) { ++ dstbase = xgi_video_info.video_linelength * dst_y; ++ dst_y = 0; ++ } ++ } ++ ++ XGI310SetupSRCBase(srcbase); ++ XGI310SetupDSTBase(dstbase); ++ XGI310SetupRect(width, height) ++ XGI310SetupSRCXY(src_x, src_y) ++ XGI310SetupDSTXY(dst_x, dst_y) ++ XGI310DoCMD ++} ++ ++static void ++XGI310SetupForSolidFill(int color, int rop, unsigned int planemask) ++{ ++ XGI310SetupPATFG(color) ++ XGI310SetupDSTRect(xgi_video_info.video_linelength, 0xFFF) ++ XGI310SetupDSTColorDepth(xgi_video_info.DstColor); ++ XGI310SetupROP(XGIPatALUConv[rop]) ++ XGI310SetupCMDFlag(PATFG | xgi_video_info.XGI310_AccelDepth) ++} ++ ++static void ++XGI310SubsequentSolidFillRect(int x, int y, int w, int h) ++{ ++ long dstbase; ++ ++ dstbase = 0; ++ if(y >= 2048) { ++ dstbase = xgi_video_info.video_linelength * y; ++ y = 0; ++ } ++ XGI310SetupDSTBase(dstbase) ++ XGI310SetupDSTXY(x,y) ++ XGI310SetupRect(w,h) ++ XGI310SetupCMDFlag(BITBLT) ++ XGI310DoCMD ++} ++ ++/* --------------------------------------------------------------------- */ ++ ++/* The exported routines */ ++ ++int XGIfb_initaccel(void) ++{ ++#ifdef XGIFB_USE_SPINLOCKS ++ spin_lock_init(&xgi_video_info.lockaccel); ++#endif ++ return(0); ++} ++ ++void XGIfb_syncaccel(void) ++{ ++ ++ XGI310Sync(); ++ ++} ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34) /* --- KERNEL 2.5.34 and later --- */ ++ ++int fbcon_XGI_sync(struct fb_info *info) ++{ ++ if(!XGIfb_accel) return 0; ++ CRITFLAGS ++ ++ XGI310Sync(); ++ ++ CRITEND ++ return 0; ++} ++ ++void fbcon_XGI_fillrect(struct fb_info *info, const struct fb_fillrect *rect) ++{ ++ int col=0; ++ CRITFLAGS ++ ++ ++ if(!rect->width || !rect->height) ++ return; ++ ++ if(!XGIfb_accel) { ++ cfb_fillrect(info, rect); ++ return; ++ } ++ ++ switch(info->var.bits_per_pixel) { ++ case 8: col = rect->color; ++ break; ++ case 16: col = ((u32 *)(info->pseudo_palette))[rect->color]; ++ break; ++ case 32: col = ((u32 *)(info->pseudo_palette))[rect->color]; ++ break; ++ } ++ ++ ++ CRITBEGIN ++ XGI310SetupForSolidFill(col, myrops[rect->rop], 0); ++ XGI310SubsequentSolidFillRect(rect->dx, rect->dy, rect->width, rect->height); ++ CRITEND ++ XGI310Sync(); ++ ++ ++} ++ ++void fbcon_XGI_copyarea(struct fb_info *info, const struct fb_copyarea *area) ++{ ++ int xdir, ydir; ++ CRITFLAGS ++ ++ ++ if(!XGIfb_accel) { ++ cfb_copyarea(info, area); ++ return; ++ } ++ ++ if(!area->width || !area->height) ++ return; ++ ++ if(area->sx < area->dx) xdir = 0; ++ else xdir = 1; ++ if(area->sy < area->dy) ydir = 0; ++ else ydir = 1; ++ ++ CRITBEGIN ++ XGI310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1); ++ XGI310SubsequentScreenToScreenCopy(area->sx, area->sy, area->dx, area->dy, area->width, area->height); ++ CRITEND ++ XGI310Sync(); ++ ++} ++ ++#endif ++ ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,33) /* ------ KERNEL <2.5.34 ------ */ ++ ++void fbcon_XGI_bmove(struct display *p, int srcy, int srcx, ++ int dsty, int dstx, int height, int width) ++{ ++ int xdir, ydir; ++ CRITFLAGS ++ ++ if(!xgi_video_info.accel) { ++ switch(xgi_video_info.video_bpp) { ++ case 8: ++#ifdef FBCON_HAS_CFB8 ++ fbcon_cfb8_bmove(p, srcy, srcx, dsty, dstx, height, width); ++#endif ++ break; ++ case 16: ++#ifdef FBCON_HAS_CFB16 ++ fbcon_cfb16_bmove(p, srcy, srcx, dsty, dstx, height, width); ++#endif ++ break; ++ case 32: ++#ifdef FBCON_HAS_CFB32 ++ fbcon_cfb32_bmove(p, srcy, srcx, dsty, dstx, height, width); ++#endif ++ break; ++ } ++ return; ++ } ++ ++ srcx *= fontwidth(p); ++ srcy *= fontheight(p); ++ dstx *= fontwidth(p); ++ dsty *= fontheight(p); ++ width *= fontwidth(p); ++ height *= fontheight(p); ++ ++ if(srcx < dstx) xdir = 0; ++ else xdir = 1; ++ if(srcy < dsty) ydir = 0; ++ else ydir = 1; ++ ++ ++ CRITBEGIN ++ XGI310SetupForScreenToScreenCopy(xdir, ydir, 3, 0, -1); ++ XGI310SubsequentScreenToScreenCopy(srcx, srcy, dstx, dsty, width, height); ++ CRITEND ++ XGI310Sync(); ++#if 0 ++ printk(KERN_INFO "XGI_bmove sx %d sy %d dx %d dy %d w %d h %d\n", ++ srcx, srcy, dstx, dsty, width, height); ++#endif ++ ++} ++ ++ ++static void fbcon_XGI_clear(struct vc_data *conp, struct display *p, ++ int srcy, int srcx, int height, int width, int color) ++{ ++ CRITFLAGS ++ ++ srcx *= fontwidth(p); ++ srcy *= fontheight(p); ++ width *= fontwidth(p); ++ height *= fontheight(p); ++ ++ ++ CRITBEGIN ++ XGI310SetupForSolidFill(color, 3, 0); ++ XGI310SubsequentSolidFillRect(srcx, srcy, width, height); ++ CRITEND ++ XGI310Sync(); ++ ++} ++ ++void fbcon_XGI_clear8(struct vc_data *conp, struct display *p, ++ int srcy, int srcx, int height, int width) ++{ ++ u32 bgx; ++ ++ if(!xgi_video_info.accel) { ++#ifdef FBCON_HAS_CFB8 ++ fbcon_cfb8_clear(conp, p, srcy, srcx, height, width); ++#endif ++ return; ++ } ++ ++ bgx = attr_bgcol_ec(p, conp); ++ fbcon_XGI_clear(conp, p, srcy, srcx, height, width, bgx); ++} ++ ++void fbcon_XGI_clear16(struct vc_data *conp, struct display *p, ++ int srcy, int srcx, int height, int width) ++{ ++ u32 bgx; ++ if(!xgi_video_info.accel) { ++#ifdef FBCON_HAS_CFB16 ++ fbcon_cfb16_clear(conp, p, srcy, srcx, height, width); ++#endif ++ return; ++ } ++ ++ bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)]; ++ fbcon_XGI_clear(conp, p, srcy, srcx, height, width, bgx); ++} ++ ++void fbcon_XGI_clear32(struct vc_data *conp, struct display *p, ++ int srcy, int srcx, int height, int width) ++{ ++ u32 bgx; ++ ++ if(!xgi_video_info.accel) { ++#ifdef FBCON_HAS_CFB32 ++ fbcon_cfb32_clear(conp, p, srcy, srcx, height, width); ++#endif ++ return; ++ } ++ ++ bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)]; ++ fbcon_XGI_clear(conp, p, srcy, srcx, height, width, bgx); ++} ++ ++void fbcon_XGI_revc(struct display *p, int srcx, int srcy) ++{ ++ CRITFLAGS ++ ++ if(!xgi_video_info.accel) { ++ switch(xgi_video_info.video_bpp) { ++ case 16: ++#ifdef FBCON_HAS_CFB16 ++ fbcon_cfb16_revc(p, srcx, srcy); ++#endif ++ break; ++ case 32: ++#ifdef FBCON_HAS_CFB32 ++ fbcon_cfb32_revc(p, srcx, srcy); ++#endif ++ break; ++ } ++ return; ++ } ++ ++ srcx *= fontwidth(p); ++ srcy *= fontheight(p); ++ ++ ++ CRITBEGIN ++ XGI310SetupForSolidFill(0, 0x0a, 0); ++ XGI310SubsequentSolidFillRect(srcx, srcy, fontwidth(p), fontheight(p)); ++ CRITEND ++ XGI310Sync(); ++ ++} ++ ++#ifdef FBCON_HAS_CFB8 ++struct display_switch fbcon_XGI8 = { ++ setup: fbcon_cfb8_setup, ++ bmove: fbcon_XGI_bmove, ++ clear: fbcon_XGI_clear8, ++ putc: fbcon_cfb8_putc, ++ putcs: fbcon_cfb8_putcs, ++ revc: fbcon_cfb8_revc, ++ clear_margins: fbcon_cfb8_clear_margins, ++ fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) ++}; ++#endif ++#ifdef FBCON_HAS_CFB16 ++struct display_switch fbcon_XGI16 = { ++ setup: fbcon_cfb16_setup, ++ bmove: fbcon_XGI_bmove, ++ clear: fbcon_XGI_clear16, ++ putc: fbcon_cfb16_putc, ++ putcs: fbcon_cfb16_putcs, ++ revc: fbcon_XGI_revc, ++ clear_margins: fbcon_cfb16_clear_margins, ++ fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) ++}; ++#endif ++#ifdef FBCON_HAS_CFB32 ++struct display_switch fbcon_XGI32 = { ++ setup: fbcon_cfb32_setup, ++ bmove: fbcon_XGI_bmove, ++ clear: fbcon_XGI_clear32, ++ putc: fbcon_cfb32_putc, ++ putcs: fbcon_cfb32_putcs, ++ revc: fbcon_XGI_revc, ++ clear_margins: fbcon_cfb32_clear_margins, ++ fontwidthmask: FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) ++}; ++#endif ++ ++#endif /* KERNEL VERSION */ ++ ++ +diff --git a/drivers/video/xgi/XGI_accel.h b/drivers/video/xgi/XGI_accel.h +new file mode 100644 +index 0000000..04e1267 +--- /dev/null ++++ b/drivers/video/xgi/XGI_accel.h +@@ -0,0 +1,511 @@ ++/* ++ * XGI 300/630/730/540/315/550/650/740 frame buffer driver ++ * for Linux kernels 2.4.x and 2.5.x ++ * ++ * 2D acceleration part ++ * ++ * Based on the X driver's XGI300_accel.h which is ++ * Copyright Xavier Ducoin <x.ducoin@lectra.com> ++ * Copyright 2002 by Thomas Winischhofer, Vienna, Austria ++ * and XGI310_accel.h which is ++ * Copyright 2002 by Thomas Winischhofer, Vienna, Austria ++ * ++ * Author: Thomas Winischhofer <thomas@winischhofer.net>: ++ * (see http://www.winischhofer.net/ ++ * for more information and updates) ++ */ ++ ++#ifndef _XGIFB_ACCEL_H ++#define _XGIFB_ACCEL_H ++ ++/* Guard accelerator accesses with spin_lock_irqsave? Works well without. */ ++#undef XGIFB_USE_SPINLOCKS ++ ++#ifdef XGIFB_USE_SPINLOCKS ++#include <linux/spinlock.h> ++#define CRITBEGIN spin_lock_irqsave(&xgi_video_info.lockaccel), critflags); ++#define CRITEND spin_unlock_irqrestore(&xgi_video_info.lockaccel), critflags); ++#define CRITFLAGS unsigned long critflags; ++#else ++#define CRITBEGIN ++#define CRITEND ++#define CRITFLAGS ++#endif ++ ++/* Definitions for the XGI engine communication. */ ++ ++#define PATREGSIZE 384 /* Pattern register size. 384 bytes @ 0x8300 */ ++#define BR(x) (0x8200 | (x) << 2) ++#define PBR(x) (0x8300 | (x) << 2) ++ ++/* XGI300 engine commands */ ++#define BITBLT 0x00000000 /* Blit */ ++#define COLOREXP 0x00000001 /* Color expand */ ++#define ENCOLOREXP 0x00000002 /* Enhanced color expand */ ++#define MULTIPLE_SCANLINE 0x00000003 /* ? */ ++#define LINE 0x00000004 /* Draw line */ ++#define TRAPAZOID_FILL 0x00000005 /* Fill trapezoid */ ++#define TRANSPARENT_BITBLT 0x00000006 /* Transparent Blit */ ++ ++/* Additional engine commands for 310/325 */ ++#define ALPHA_BLEND 0x00000007 /* Alpha blend ? */ ++#define A3D_FUNCTION 0x00000008 /* 3D command ? */ ++#define CLEAR_Z_BUFFER 0x00000009 /* ? */ ++#define GRADIENT_FILL 0x0000000A /* Gradient fill */ ++#define STRETCH_BITBLT 0x0000000B /* Stretched Blit */ ++ ++/* source select */ ++#define SRCVIDEO 0x00000000 /* source is video RAM */ ++#define SRCSYSTEM 0x00000010 /* source is system memory */ ++#define SRCCPUBLITBUF SRCSYSTEM /* source is CPU-driven BitBuffer (for color expand) */ ++#define SRCAGP 0x00000020 /* source is AGP memory (?) */ ++ ++/* Pattern flags */ ++#define PATFG 0x00000000 /* foreground color */ ++#define PATPATREG 0x00000040 /* pattern in pattern buffer (0x8300) */ ++#define PATMONO 0x00000080 /* mono pattern */ ++ ++/* blitting direction (300 series only) */ ++#define X_INC 0x00010000 ++#define X_DEC 0x00000000 ++#define Y_INC 0x00020000 ++#define Y_DEC 0x00000000 ++ ++/* Clipping flags */ ++#define NOCLIP 0x00000000 ++#define NOMERGECLIP 0x04000000 ++#define CLIPENABLE 0x00040000 ++#define CLIPWITHOUTMERGE 0x04040000 ++ ++/* Transparency */ ++#define OPAQUE 0x00000000 ++#define TRANSPARENT 0x00100000 ++ ++/* ? */ ++#define DSTAGP 0x02000000 ++#define DSTVIDEO 0x02000000 ++ ++/* Line */ ++#define LINE_STYLE 0x00800000 ++#define NO_RESET_COUNTER 0x00400000 ++#define NO_LAST_PIXEL 0x00200000 ++ ++/* Subfunctions for Color/Enhanced Color Expansion (310/325 only) */ ++#define COLOR_TO_MONO 0x00100000 ++#define AA_TEXT 0x00200000 ++ ++/* Some general registers for 310/325 series */ ++#define SRC_ADDR 0x8200 ++#define SRC_PITCH 0x8204 ++#define AGP_BASE 0x8206 /* color-depth dependent value */ ++#define SRC_Y 0x8208 ++#define SRC_X 0x820A ++#define DST_Y 0x820C ++#define DST_X 0x820E ++#define DST_ADDR 0x8210 ++#define DST_PITCH 0x8214 ++#define DST_HEIGHT 0x8216 ++#define RECT_WIDTH 0x8218 ++#define RECT_HEIGHT 0x821A ++#define PAT_FGCOLOR 0x821C ++#define PAT_BGCOLOR 0x8220 ++#define SRC_FGCOLOR 0x8224 ++#define SRC_BGCOLOR 0x8228 ++#define MONO_MASK 0x822C ++#define LEFT_CLIP 0x8234 ++#define TOP_CLIP 0x8236 ++#define RIGHT_CLIP 0x8238 ++#define BOTTOM_CLIP 0x823A ++#define COMMAND_READY 0x823C ++#define FIRE_TRIGGER 0x8240 ++ ++#define PATTERN_REG 0x8300 /* 384 bytes pattern buffer */ ++ ++/* Line registers */ ++#define LINE_X0 SRC_Y ++#define LINE_X1 DST_Y ++#define LINE_Y0 SRC_X ++#define LINE_Y1 DST_X ++#define LINE_COUNT RECT_WIDTH ++#define LINE_STYLE_PERIOD RECT_HEIGHT ++#define LINE_STYLE_0 MONO_MASK ++#define LINE_STYLE_1 0x8230 ++#define LINE_XN PATTERN_REG ++#define LINE_YN PATTERN_REG+2 ++ ++/* Transparent bitblit registers */ ++#define TRANS_DST_KEY_HIGH PAT_FGCOLOR ++#define TRANS_DST_KEY_LOW PAT_BGCOLOR ++#define TRANS_SRC_KEY_HIGH SRC_FGCOLOR ++#define TRANS_SRC_KEY_LOW SRC_BGCOLOR ++ ++/* Queue */ ++#define Q_BASE_ADDR 0x85C0 /* Base address of software queue (?) */ ++#define Q_WRITE_PTR 0x85C4 /* Current write pointer (?) */ ++#define Q_READ_PTR 0x85C8 /* Current read pointer (?) */ ++#define Q_STATUS 0x85CC /* queue status */ ++ ++ ++#define MMIO_IN8(base, offset) \ ++ *(volatile u8 *)(((u8*)(base)) + (offset)) ++#define MMIO_IN16(base, offset) \ ++ *(volatile u16 *)(void *)(((u8*)(base)) + (offset)) ++#define MMIO_IN32(base, offset) \ ++ *(volatile u32 *)(void *)(((u8*)(base)) + (offset)) ++#define MMIO_OUT8(base, offset, val) \ ++ *(volatile u8 *)(((u8*)(base)) + (offset)) = (val) ++#define MMIO_OUT16(base, offset, val) \ ++ *(volatile u16 *)(void *)(((u8*)(base)) + (offset)) = (val) ++#define MMIO_OUT32(base, offset, val) \ ++ *(volatile u32 *)(void *)(((u8*)(base)) + (offset)) = (val) ++ ++ ++ ++/* ------------- XGI 300 series -------------- */ ++ ++/* Macros to do useful things with the XGI BitBLT engine */ ++ ++/* BR(16) (0x8420): ++ ++ bit 31 2D engine: 1 is idle, ++ bit 30 3D engine: 1 is idle, ++ bit 29 Command queue: 1 is empty ++ ++ bits 28:24: Current CPU driven BitBlt buffer stage bit[4:0] ++ ++ bits 15:0: Current command queue length ++ ++*/ ++ ++/* TW: BR(16)+2 = 0x8242 */ ++ ++int xgiCmdQueLen; ++ ++#define XGI300Idle \ ++ { \ ++ while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ ++ while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ ++ while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ ++ xgiCmdQueLen=MMIO_IN16(xgi_video_info.mmio_vbase, 0x8240); \ ++ } ++/* TW: (do three times, because 2D engine seems quite unsure about whether or not it's idle) */ ++ ++#define XGI300SetupSRCBase(base) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(0), base);\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupSRCPitch(pitch) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT16(xgi_video_info.mmio_vbase, BR(1), pitch);\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupSRCXY(x,y) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(2), (x)<<16 | (y) );\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupDSTBase(base) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(4), base);\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupDSTXY(x,y) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(3), (x)<<16 | (y) );\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupDSTRect(x,y) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(5), (y)<<16 | (x) );\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupDSTColorDepth(bpp) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT16(xgi_video_info.mmio_vbase, BR(1)+2, bpp);\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupRect(w,h) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(6), (h)<<16 | (w) );\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupPATFG(color) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(7), color);\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupPATBG(color) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(8), color);\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupSRCFG(color) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(9), color);\ ++ xgiCmdQueLen --; ++ ++#define XGI300SetupSRCBG(color) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(10), color);\ ++ xgiCmdQueLen --; ++ ++/* 0x8224 src colorkey high */ ++/* 0x8228 src colorkey low */ ++/* 0x821c dest colorkey high */ ++/* 0x8220 dest colorkey low */ ++#define XGI300SetupSRCTrans(color) \ ++ if (xgiCmdQueLen <= 1) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8224, color);\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8228, color);\ ++ xgiCmdQueLen -= 2; ++ ++#define XGI300SetupDSTTrans(color) \ ++ if (xgiCmdQueLen <= 1) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, 0x821C, color); \ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8220, color); \ ++ xgiCmdQueLen -= 2; ++ ++#define XGI300SetupMONOPAT(p0,p1) \ ++ if (xgiCmdQueLen <= 1) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(11), p0);\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(12), p1);\ ++ xgiCmdQueLen -= 2; ++ ++#define XGI300SetupClipLT(left,top) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\ ++ xgiCmdQueLen--; ++ ++#define XGI300SetupClipRB(right,bottom) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\ ++ xgiCmdQueLen--; ++ ++/* General */ ++#define XGI300SetupROP(rop) \ ++ xgi_video_info.CommandReg = (rop) << 8; ++ ++#define XGI300SetupCMDFlag(flags) \ ++ xgi_video_info.CommandReg |= (flags); ++ ++#define XGI300DoCMD \ ++ if (xgiCmdQueLen <= 1) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(15), xgi_video_info.CommandReg); \ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(16), 0);\ ++ xgiCmdQueLen -= 2; ++ ++/* Line */ ++#define XGI300SetupX0Y0(x,y) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(2), (y)<<16 | (x) );\ ++ xgiCmdQueLen--; ++ ++#define XGI300SetupX1Y1(x,y) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT32(xgi_video_info.mmio_vbase, BR(3), (y)<<16 | (x) );\ ++ xgiCmdQueLen--; ++ ++#define XGI300SetupLineCount(c) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT16(xgi_video_info.mmio_vbase, BR(6), c);\ ++ xgiCmdQueLen--; ++ ++#define XGI300SetupStylePeriod(p) \ ++ if (xgiCmdQueLen <= 0) XGI300Idle;\ ++ MMIO_OUT16(xgi_video_info.mmio_vbase, BR(6)+2, p);\ ++ xgiCmdQ |
